private static RegistrationInfo Add(this ContainerBuilder builder, Type serviceType, Type implementationType = null, Func <IResolver, object> factory = null, object instance = null) { var info = new RegistrationInfo { ServiceType = serviceType, ImplementationType = implementationType ?? serviceType, Factory = factory, Instance = instance }; builder.Registrations.Add(info); return(info); }
public static RegistrationInfo As <TService>(this RegistrationInfo info) { Throw.IfImplementationIsNotAssignableToService(info.ImplementationType, typeof(TService)); info.ServiceType = typeof(TService); return(info); }
public static RegistrationInfo InstancePerMatchingLifetimeScope(this RegistrationInfo info, object scopeName) { return(info.WithReuse(Reuse.ScopedTo(scopeName))); }
public static RegistrationInfo InstancePerOwned <TService>(this RegistrationInfo info) { return(info.WithReuse(Reuse.ScopedTo <Owned <TService> >())); }
public static RegistrationInfo SingleInstance(this RegistrationInfo info) { return(info.WithReuse(Reuse.Singleton)); }
private static RegistrationInfo WithReuse(this RegistrationInfo info, IReuse reuse) { info.Reuse = reuse; return(info); }
/// Reuse.Singleton public static RegistrationInfo SingleInstance(this RegistrationInfo info) => info.WithReuse(Reuse.Singleton);