public void RegisterFactory <T1, T2, T3, TResult>(Func <T1, T2, T3, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class { IReuse reuse = null; switch (lifestyle) { case RegistrationLifestyle.Singleton: reuse = new SingletonReuse(); break; case RegistrationLifestyle.SingletonPerScope: reuse = new CurrentScopeReuse(); break; case RegistrationLifestyle.SingletonPerObjectGraph: throw new NotSupportedException(""); } _container.RegisterDelegate(r => factory(r.Resolve <T1>(), r.Resolve <T2>(), r.Resolve <T3>()), reuse); }
public void Registration(IEnumerable <RegistrationDefinition> definitions) { foreach (var definition in definitions) { IReuse reuse = null; switch (definition.RegistrationLifestyle) { case RegistrationLifestyle.Singleton: reuse = new SingletonReuse(); break; case RegistrationLifestyle.SingletonPerScope: reuse = new CurrentScopeReuse(); break; } PropertiesAndFieldsSelector madeOf = null; if (definition.MemberInjectionList != null) { madeOf = PropertiesAndFields.Of; foreach (var injectionInfo in definition.MemberInjectionList) { switch (injectionInfo.InjectionType) { case MemberInjectionType.Field: case MemberInjectionType.Property: madeOf = madeOf.Name(injectionInfo.MemberName); break; case MemberInjectionType.Method: throw new NotSupportedException(); } } } _container.Register(definition.ExportType, definition.ActivationType, reuse, madeOf); } }
// typeof(IAllOpts) internal static object Get29_IAllOpts(IResolverContext r) { return(CurrentScopeReuse.GetScoped(r, true, 82, () => new AllOpts(), 0)); }
// typeof(NamedScopeService) internal static object Get12_NamedScopeService(IResolverContext r) { return(CurrentScopeReuse.GetNameScoped(r, "a", true, 84, () => new NamedScopeService(), 0)); }