/// <summary>Initializes a new instance of the <see cref="ContainerOptions"/> class.</summary> public ContainerOptions() { this.resolutionBehavior = new DefaultConstructorResolutionBehavior(); this.verificationBehavior = new DefaultConstructorVerificationBehavior(); this.injectionBehavior = new DefaultConstructorInjectionBehavior(() => this.Container); this.propertyBehavior = new DefaultPropertySelectionBehavior(); this.lifestyleBehavior = new TransientLifestyleSelectionBehavior(); }
private static Lifestyle GetAppropriateLifestyle(Type wcfServiceType, ILifestyleSelectionBehavior behavior) { var attribute = GetServiceBehaviorAttribute(wcfServiceType); bool singleton = attribute?.InstanceContextMode == InstanceContextMode.Single; return(singleton ? Lifestyle.Singleton : behavior.SelectLifestyle(wcfServiceType)); }
internal ContainerOptions(Container container) { Requires.IsNotNull(container, nameof(container)); this.Container = container; this.resolutionBehavior = new DefaultConstructorResolutionBehavior(); this.injectionBehavior = new DefaultDependencyInjectionBehavior(container); this.propertyBehavior = new DefaultPropertySelectionBehavior(); this.lifestyleBehavior = new DefaultLifestyleSelectionBehavior(this); }
internal ContainerOptions(Container container) { Requires.IsNotNull(container, "container"); this.Container = container; this.resolutionBehavior = new DefaultConstructorResolutionBehavior(); this.injectionBehavior = new DefaultDependencyInjectionBehavior(container); this.propertyBehavior = new DefaultPropertySelectionBehavior(); this.lifestyleBehavior = new DefaultLifestyleSelectionBehavior(Lifestyle.Transient); this.batchRegistrationBehavior = new DefaultBatchRegistrationBehavior(container); }
internal static string LifestyleSelectionBehaviorReturnedNull( ILifestyleSelectionBehavior selectionBehavior, Type serviceType, Type implementationType) { return(string.Format(CultureInfo.InvariantCulture, "The {0} that was registered through Container.Options.LifestyleSelectionBehavior " + "returned a null reference after its SelectLifestyle(Type, Type) method was " + "supplied with values '{1}' for serviceType and '{2}' for implementationType. " + "{3}.SelectLifestyle implementations should never return null.", selectionBehavior.GetType().ToFriendlyName(), serviceType.ToFriendlyName(), implementationType.ToFriendlyName(), typeof(ILifestyleSelectionBehavior).Name)); }
internal static string LifestyleSelectionBehaviorReturnedNull( ILifestyleSelectionBehavior selectionBehavior, Type serviceType, Type implementationType) => string.Format(CultureInfo.InvariantCulture, "The {0} that was registered through Container.{4}.{5} returned a null reference after " + "its {6}(Type, Type) method was supplied with values '{1}' for serviceType and '{2}' for " + "implementationType. {3}.{6} implementations should never return null.", selectionBehavior.GetType().ToFriendlyName(), serviceType.ToFriendlyName(), implementationType.ToFriendlyName(), nameof(ILifestyleSelectionBehavior), nameof(Container.Options), nameof(ContainerOptions.LifestyleSelectionBehavior), nameof(ILifestyleSelectionBehavior.SelectLifestyle));
internal static string LifestyleSelectionBehaviorReturnedNull( ILifestyleSelectionBehavior selectionBehavior, Type serviceType, Type implementationType) { return string.Format(CultureInfo.InvariantCulture, "The {0} that was registered through Container.Options.LifestyleSelectionBehavior " + "returned a null reference after its SelectLifestyle(Type, Type) method was " + "supplied with values '{1}' for serviceType and '{2}' for implementationType. " + "{3}.SelectLifestyle implementations should never return null.", selectionBehavior.GetType().ToFriendlyName(), serviceType.ToFriendlyName(), implementationType.ToFriendlyName(), typeof(ILifestyleSelectionBehavior).Name); }
internal ContainerOptions(Container container) { Requires.IsNotNull(container, nameof(container)); this.Container = container; this.resolutionBehavior = new DefaultConstructorResolutionBehavior(); this.injectionBehavior = new DefaultDependencyInjectionBehavior(container); this.propertyBehavior = new DefaultPropertySelectionBehavior(); this.lifestyleBehavior = new DefaultLifestyleSelectionBehavior(Lifestyle.Transient); }