public static void CreateFactory <PLUGINTYPE>(this CreatePluginFamilyExpression <PLUGINTYPE> expression) where PLUGINTYPE : class { var callback = CreateFactoryCallback <PLUGINTYPE>(); expression.Use(callback); }
public static void CreateFactory <TPluginType>(this CreatePluginFamilyExpression <TPluginType> expression) where TPluginType : class { var callback = CreateFactoryCallback <TPluginType>(); expression.Use(callback); }
public static void CreateFactory <TPluginType>(this CreatePluginFamilyExpression <TPluginType> expression) where TPluginType : class { var callback = CreateFactoryCallback <TPluginType>(); expression.Use("AutoFactory builder for " + typeof(TPluginType).GetFullName(), callback); }
public static void CreateFactory <TPluginType>(this CreatePluginFamilyExpression <TPluginType> expression, IAutoFactoryConventionProvider conventionProvider) where TPluginType : class { var callback = CreateFactoryCallback <TPluginType>(conventionProvider); expression.Use(GetDescription <TPluginType>(), callback); }
public DecoratorHelper(CreatePluginFamilyExpression <TTarget> target) { ContextEnrichmentHandler <TTarget> callback = (ctx, t) => t; _decorateCommand = e => { callback = e; }; target.EnrichAllWith((ctx, t) => callback(ctx, t)); }
public void BuildPluginFamilyAsSingleton() { var registry = new Registry(); CreatePluginFamilyExpression <IGateway> expression = registry.For <IGateway>().Singleton(); Assert.IsNotNull(expression); PluginGraph pluginGraph = registry.Build(); PluginFamily family = pluginGraph.Families[typeof(IGateway)]; family.Lifecycle.ShouldBeOfType <SingletonLifecycle>(); }
internal void Register( CreatePluginFamilyExpression <TInter> @for, SmartInstance <TImpl, TInter> use, string instanceName, DILifeTime lifetime, Action <DILifeTime, LambdaInstance <TImpl, TInter> > setLifeTime) { this.@for = @for; this.use = use; this.instanceName = instanceName; this.lifetime = lifetime; this.setLifeTime = setLifeTime; }
public void AsAnotherScope() { var registry = new Registry(); CreatePluginFamilyExpression <IGateway> expression = registry.For <IGateway>(Lifecycles.ThreadLocal); Assert.IsNotNull(expression); PluginGraph pluginGraph = registry.Build(); PluginFamily family = pluginGraph.Families[typeof(IGateway)]; family.Lifecycle.ShouldBeOfType <ThreadLocalStorageLifecycle>(); }
public void AsAnotherScope() { var registry = new Registry(); CreatePluginFamilyExpression <IGateway> expression = registry.BuildInstancesOf <IGateway>().CacheBy(InstanceScope.ThreadLocal); Assert.IsNotNull(expression); PluginGraph pluginGraph = registry.Build(); PluginFamily family = pluginGraph.FindFamily(typeof(IGateway)); family.Lifecycle.ShouldBeOfType <ThreadLocalStorageLifecycle>(); }
public void BuildPluginFamilyAsPerRequest() { var registry = new Registry(); CreatePluginFamilyExpression <IGateway> expression = registry.BuildInstancesOf <IGateway>(); Assert.IsNotNull(expression); PluginGraph pluginGraph = registry.Build(); PluginFamily family = pluginGraph.FindFamily(typeof(IGateway)); family.Lifecycle.ShouldBeNull(); }
public static void CreateFactory <TPluginType>(this CreatePluginFamilyExpression <TPluginType> expression) where TPluginType : class { CreateFactory(expression, new DefaultAutoFactoryConventionProvider()); }
public StructureMapMapping(Registry registry, Func <IServiceLocator, TInterface> function) { _for = registry.For <TInterface>(); _for.Use(() => function(ServiceLocator.Current)); }
public StructureMapMapping(Registry registry, Func <TInterface> function) { _for = registry.For <TInterface>(); _for.Use(function); }
public StructureMapMapping(Registry registry) { _for = registry.For <TInterface>(); _mapping = _for.Use <TImplementation>(); }
public static CreatePluginFamilyExpression <TPlugin> TransientOrHybridHttpScoped <TPlugin>(this CreatePluginFamilyExpression <TPlugin> expression) { if (BootstrapRegistry.MaintainAspNetCompatibility) { return(expression.HybridHttpOrThreadLocalScoped()); } return(expression); }
public static DecoratorHelper <TTarget> Decorate <TTarget>(this CreatePluginFamilyExpression <TTarget> target) { return(new DecoratorHelper <TTarget>(target)); }
public FeatureTogglingContext(Predicate <ITpFeatureList> condition, CreatePluginFamilyExpression <TService> expression) { _condition = condition; _expression = expression; }
public static FeatureTogglingContext <TService> IfFeatureEnabled <TService>(this CreatePluginFamilyExpression <TService> expr, TpFeature feature) { return(new FeatureTogglingContext <TService>(features => features.IsEnabled(feature), expr)); }
public static FeatureTogglingContext <TService> IfFeatureEnabled <TService>(this CreatePluginFamilyExpression <TService> expr, Predicate <ITpFeatureList> condition) { return(new FeatureTogglingContext <TService>(condition, expr)); }
/// <summary> /// Convenience method to mark a PluginFamily as HttpContext scoped /// </summary> /// <returns></returns> public static CreatePluginFamilyExpression <TPluginType> HttpContextScoped <TPluginType>(this CreatePluginFamilyExpression <TPluginType> source) { return(source.LifecycleIs(WebLifecycles.HttpContext)); }
/// <summary> /// Convenience method to mark a PluginFamily as a Hybrid lifecycle /// </summary> /// <returns></returns> public static CreatePluginFamilyExpression <TPluginType> HybridHttpOrThreadLocalScoped <TPluginType>(this CreatePluginFamilyExpression <TPluginType> source) { return(source.LifecycleIs(WebLifecycles.Hybrid)); }