protected override IDependencyFactory AddTo(IDependencyRegistry dependencyRegistry) { var dependencyFactory = new LinkedFactory(dependencyRegistry, RootBuilder.Type, LinkedType, LinkedKey, RootBuilder.Key, RootBuilder.Substitution); dependencyRegistry.Add(dependencyFactory); return(dependencyFactory); }
public LinkedFactory(IDependencyRegistry dependencyRegistry, Type linkedType, Type registeredType, object registeredKey, object serviceKey, Substitution substitution) : base(linkedType, serviceKey, substitution) { _dependencyRegistry = dependencyRegistry; _registeredType = registeredType; _registeredKey = registeredKey; }
public LinkedGenericFactory(IDependencyRegistry dependencyRegistry, Type linkedTypeDescription, Type registeredTypeDescription, object registeredKey, object serviceKey, Substitution substitution) : base(linkedTypeDescription, serviceKey, substitution) { _dependencyRegistry = dependencyRegistry; _registeredTypeDescription = registeredTypeDescription; _registeredKey = registeredKey; }
public void RegisterServices(IDependencyRegistry container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } }
protected override IGenericFactory AddTo(IDependencyRegistry dependencyRegistry) { var linkedGenericFactory = new LinkedGenericFactory(dependencyRegistry, RootBuilder.TypeDefinition, LinkedType, LinkedKey, RootBuilder.Key, RootBuilder.Substitution); dependencyRegistry.Add(linkedGenericFactory); return(linkedGenericFactory); }
public void RegisterServices(IDependencyRegistry container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } container.RegisterScopedType <IUnitOfWork, EFCoreUnitOfWork>(); }
public void RegisterDependencies(IDependencyRegistry registry) { ScanInstructions .ForEach(registry.Scan); Dependencies .ForEach(registry.Register); }
public static void RegisterPlugin <TExtensionPoint, TDependencyType, TConcreteType>( this IDependencyRegistry @this, ObjectScope scope ) where TConcreteType : TDependencyType where TExtensionPoint : IExtensionPoint <TDependencyType> { }
public static void RegisterPluginFactory <TExtensionPoint, TDependencyType, TFactoryType>( this IDependencyRegistry @this, ObjectScope scope ) where TFactoryType : IFactory <TDependencyType> where TExtensionPoint : IExtensionPoint <TDependencyType> { }
public GlyphResolveContext([Resolvable(Key = ResolverScope.Global)] RegistryResolver globalResolver, [Resolvable(Key = ResolverScope.Local)] IDependencyRegistry localRegistry, LocalDependencyResolver localResolverParent = null) { GlobalResolver = globalResolver; LocalRegistry = localRegistry; LocalResolverParent = localResolverParent; }
void IDependencyLoader.Load(IDependencyRegistry registry) { registry.Register <ID2LPrincipal, D2LPrincipalWrapper>(ObjectScope.WebRequest); registry.Register <ID2LPrincipalDependencyRegistry, D2LPrincipalDependencyRegistry>(ObjectScope.Singleton); registry.RegisterFactory <IRequestAuthenticator, Temp_RequestAuthenticatorFactory>(ObjectScope.Singleton); registry.Register <IWebApiAuthConfigurator, WebApiAuthConfigurator>(ObjectScope.Singleton); registry.Register <OAuth2AuthenticationFilter>(ObjectScope.Singleton); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { var configuration = new Configuration(); dependencyRegistry.RegisterCreator<IConfiguration>(() => configuration); dependencyRegistry.RegisterBinding<IHttpRequestExecutor, HttpRequestExecutor>(); dependencyRegistry.RegisterBinding<IBuildExecutor, BuildExecutor>(); dependencyRegistry.RegisterBinding<IMaintenanceTarballCreator, MaintenanceTarballCreator>(); }
public void RegisterServices(IDependencyRegistry container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } container.RegisterInstance <BusinessLogic.ServiceAPI.ILogger>(new Log4NetLogger()); }
protected void RegisterClosingType(Type type, Type match, IDependencyRegistry registry) { var name = HasNamingStrategy ? NamingStrategy(type) : string.Empty; var dependencyExpression = HasNamingStrategy ? DependencyExpression.For(name, type) : DependencyExpression.For(type); dependencyExpression.Use(match); registry.Register(dependencyExpression); }
private void RegisterDependencies(IDependencyRegistry registry) { registry.RegisterSingleton <NavigationService, INavigationService>(); //register views that need to be navigated with NavigateToAsync() ie. Not Root Shell pages registry.Register <ItemPage, IView>(NavigationRoutes.ItemPage); registry.Register <AboutPage, IView>(NavigationRoutes.AboutPage); //register view models for views registry.Register <HomeViewModel, IViewModel>(NavigationRoutes.HomePage); registry.Register <ItemViewModel, IViewModel>(NavigationRoutes.ItemPage); registry.Register <AboutViewModel, IViewModel>(NavigationRoutes.AboutPage); }
protected void RegisterSingleImplementations(IDependencyRegistry registry) { Assimilate .ScanIndex .SingleImplementations .Where(x => x.Value.IsConcrete()) .ForEach(x => { var dependencyExpression = DependencyExpression.For(x.Key); dependencyExpression.Use(x.Value); registry.Register(dependencyExpression); }); }
public void Execute(IDependencyRegistry registry) { AutoWireupTypesOf .ForEach(x => RegisterAllTypesOf(x, registry)); AutoWireupClosersOf .Where(x => x.IsOpenGeneric()) .ForEach(x => RegisterClosingTypes(x, registry)); if (ShouldAddSingleImplementations) { RegisterSingleImplementations(registry); } }
protected void RegisterTypeClosingInterface(Type type, Type match, IDependencyRegistry registry) { match.GetInterfaces() .Where(x => x.IsGenericType && x.GetGenericTypeDefinition().Equals(type)) .ForEach(x => { var pluginType = type.MakeGenericType(x.GetGenericArguments()); var name = HasNamingStrategy ? NamingStrategy(type) : string.Empty; var dependencyExpression = HasNamingStrategy ? DependencyExpression.For(name, pluginType) : DependencyExpression.For(pluginType); dependencyExpression.Add(match); registry.Register(dependencyExpression); }); }
/// <summary> /// IOC registry /// </summary> /// <param name="containerManager"></param> /// <returns></returns> private ContainerManager forDependencyRegistrary(ContainerManager containerManager) { containerManager.DoRegistry += (builder) => { Type aType = typeof(IDependencyRegistry); Assembly assembly = Assembly.GetExecutingAssembly(); IEnumerable <Type> types = assembly.GetTypes().Where(type => aType.IsAssignableFrom(type) && type.IsClass && !type.IsAbstract); foreach (var item in types) { IDependencyRegistry dr = (IDependencyRegistry)Activator.CreateInstance(item); dr.Register(builder); } ddrr = new DynamicDependencyRegistry(builder); }; return(containerManager); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator<ICaptchaGenerator>(() => { if (HttpContext.Current.Request.RawUrl.Contains("WithBypass")) return new BypassCaptchaGenerator(); return new ReCaptchaGenerator(); }); dependencyRegistry.RegisterCreator<ICaptchaValidator>(() => { if (HttpContext.Current.Request.RawUrl.Contains("WithBypass")) return new BypassCaptchaValidator(); return new ReCaptchaValidator(); }); }
void IDependencyLoader.Load(IDependencyRegistry registry) { registry.RegisterInstance <IConfigViewer>(m_configViewer); registry.RegisterInstance <ILogProvider>(m_logProvider); registry.LoadFrom <Auth.DependencyLoader>(); // If the user provided a type for their core loader, load from it // TODO: this seems kinda lame. Reconsider. if (m_dependencyLoaderType != null) { var method = typeof(IDependencyRegistry) .GetMethod("LoadFrom") .MakeGenericMethod(m_dependencyLoaderType); method.Invoke(registry, null); } }
protected void RegisterAllTypesOf(Type type, IDependencyRegistry registry) { var list = Assimilate.ScanIndex.ImplementorsOfType.TryGet(type); if (list.Item1) { list.Item2 .Where(x => x.IsConcrete()) .Where(x => x.GetGenericCardinality() == type.GetGenericCardinality()) .ForEach(m => { var name = HasNamingStrategy ? NamingStrategy(m) : string.Empty; var dependencyExpression = HasNamingStrategy ? DependencyExpression.For(name, type) : DependencyExpression.For(type); dependencyExpression.Add(m); registry.Register(dependencyExpression); }); } }
public void Configure(IDependencyRegistry registry) { foreach (IDependencyBuilder <IDependencyFactory> typeDependencyBuilder in _typeDependencyBuilders) { registry.Add(typeDependencyBuilder); } foreach (IDependencyBuilder <IGenericFactory> genericDependencyBuilder in _genericDependencyBuilders) { registry.Add(genericDependencyBuilder); } foreach (ILinkDependencyBuilder <IDependencyFactory> linkTypeDependencyBuilder in _linkTypeDependencyBuilders) { registry.Add(linkTypeDependencyBuilder); } foreach (ILinkDependencyBuilder <IGenericFactory> linkGenericDependencyBuilder in _linkGenericDependencyBuilders) { registry.Add(linkGenericDependencyBuilder); } }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator <IMailSender>(() => { var mailSenderConfiguration = new MailSenderConfiguration { DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory, PickupDirectoryLocation = HttpContext.Current.Server.MapPath("~/App_Data/Mail") }; //var mailSenderConfiguration = new MailSenderConfiguration() { // DeliveryMethod = SmtpDeliveryMethod.Network, // EnableSsl = true, // Host = "smtp.gmail.com", // Port = 587, // UseDefaultCredentials = false, // Credentials = new NetworkCredential("<your-gmail-address>", "<your-gmail-password>") //}; return(new MarkdownSharpMailSender(mailSenderConfiguration)); }); }
protected void RegisterClosingTypes(Type type, IDependencyRegistry registry) { var list = Assimilate.ScanIndex.Closers.TryGet(type); if (!list.Item1) { return; } var matches = list.Item2.Where(x => !x.IsAbstract && !x.IsInterface); foreach (var match in matches) { if (type.IsInterface) { RegisterTypeClosingInterface(type, match, registry); } else { RegisterClosingType(type, match, registry); } } }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator <ICaptchaGenerator>(() => { if (HttpContext.Current.Request.RawUrl.Contains("WithBypass")) { return(new BypassCaptchaGenerator()); } return(new ReCaptchaGenerator()); }); dependencyRegistry.RegisterCreator <ICaptchaValidator>(() => { if (HttpContext.Current.Request.RawUrl.Contains("WithBypass")) { return(new BypassCaptchaValidator()); } return(new ReCaptchaValidator()); }); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator<IMailSender>(() => { var mailSenderConfiguration = new MailSenderConfiguration { DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory, PickupDirectoryLocation = HttpContext.Current.Server.MapPath("~/App_Data/Mail") }; //var mailSenderConfiguration = new MailSenderConfiguration() { // DeliveryMethod = SmtpDeliveryMethod.Network, // EnableSsl = true, // Host = "smtp.gmail.com", // Port = 587, // UseDefaultCredentials = false, // Credentials = new NetworkCredential("<your-gmail-address>", "<your-gmail-password>") //}; return new MailSender(mailSenderConfiguration); }); }
public void RegisterServices(IDependencyRegistry container) { }
// from: http://search.dev.d2l/source/xref/Lms/core/lp/framework/core/D2L.LP.Foundation/LP/Extensibility/Activation/Domain/DependencyRegistryExtensionPointExtensions.cs public static void RegisterPluginExtensionPoint <TExtensionPoint, T>( this IDependencyRegistry @this, ObjectScope scope ) where TExtensionPoint : IExtensionPoint <T>;
public static void ConfigureOrderedPlugins <TPlugin, TComparer>( this IDependencyRegistry registry, ObjectScope scope ) where TComparer : IComparer <TPlugin>, new();
// from: http://search.dev.d2l/source/xref/Lms/core/lp/framework/core/D2L.LP.Foundation/LP/Extensibility/Activation/Domain/IDependencyRegistryConfigurePluginsExtensions.cs public static void ConfigurePlugins <TPlugin>( this IDependencyRegistry registry, ObjectScope scope );
public static void RegisterDynamicObjectFactory <TOutput, TConcrete, TArg0, TArg1>( this IDependencyRegistry registry, ObjectScope scope ) where TConcrete : class, TOutput;
public void SetUp() { _registry = new DependencyRegistry(); _injector = new RegistryInjector(_registry); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator <IMailSender>(() => mailSenderThunk.Value); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator<IGreetingService>( "greetingService", () => new GreetingService()); }
public void RegisterDependencies(IDependencyRegistry dependencyRegistry) { dependencyRegistry.RegisterCreator<IMailSender>(() => mailSenderThunk.Value); }