Skip to content

Commit

Permalink
Exception message improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnetjunkie committed Jan 1, 2019
1 parent 4bead5b commit 56c55d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/SimpleInjector/Lifestyles/ScopedProxyLifestyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ private static ScopedLifestyle GetDefaultScopedLifestyle(Container container) =>
private static ScopedLifestyle ThrowDefaultScopeLifestyleIsNotSet()
{
throw new InvalidOperationException(
"To be able to use the Lifestyle.Scoped property, please ensure that the container is " +
"configured with a default scoped lifestyle by setting the Container.Options." +
"DefaultScopedLifestyle property with the required scoped lifestyle for your type of " +
"application. See: https://simpleinjector.org/lifestyles#scoped");
StringResources.ScopePropertyCanOnlyBeUsedWhenDefaultScopedLifestyleIsConfigured());
}
}
}
6 changes: 6 additions & 0 deletions src/SimpleInjector/StringResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ internal static string TypeAlreadyRegistered(Type serviceType) =>
nameof(Container) + "." + nameof(Container.Options),
nameof(ContainerOptions.AllowOverridingRegistrations));

internal static string ScopePropertyCanOnlyBeUsedWhenDefaultScopedLifestyleIsConfigured() =>
"To be able to use the Lifestyle.Scoped property, please ensure that the container is " +
"configured with a default scoped lifestyle by setting the Container.Options." +
"DefaultScopedLifestyle property with the required scoped lifestyle for your type of " +
"application. For more information, see https://simpleinjector.org/scoped.";

internal static string MakingConditionalRegistrationsInOverridingModeIsNotSupported() =>
string.Format(CultureInfo.InvariantCulture,
"The making of conditional registrations is not supported when {0} is set, because it is " +
Expand Down

0 comments on commit 56c55d8

Please sign in to comment.