public void Load(IIocBuilder builder) { builder.RegisterType <IDbProvider, DefaultDbProvider>(); builder.RegisterType <ISqlFileExecutor, DefaultSqlFileExecutor>(); builder.RegisterFactory <DbContext, DbContextFactory>(); builder.RegisterGeneric(typeof(IRepository <>), typeof(DbContextRepository <>)); }
public void Load(IIocBuilder builder) { builder.RegisterType<IDbProvider, DefaultDbProvider>(); builder.RegisterType<ISqlFileExecutor, DefaultSqlFileExecutor>(); builder.RegisterFactory<DbContext, DbContextFactory>(); builder.RegisterGeneric(typeof(IRepository<>), typeof(DbContextRepository<>)); }
public void Load(IIocBuilder builder) { builder.RegisterType<IScheduleTimer, ElapseScheduleTimer>(LifeTimeScope.Singleton); builder.RegisterType<IScheduleManager, DefaultScheduleManager>(LifeTimeScope.Singleton); builder.RegisterType<IScheduleTrigger, TimingTrigger>(name: "TimingTrigger"); builder.RegisterType<IOperation, NullOperation>(name: "NullOperation"); builder.RegisterType<IAppEventHandler, ScheduleAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType <IScheduleTimer, ElapseScheduleTimer>(LifeTimeScope.Singleton); builder.RegisterType <IScheduleManager, DefaultScheduleManager>(LifeTimeScope.Singleton); builder.RegisterType <IScheduleTrigger, TimingTrigger>(name: "TimingTrigger"); builder.RegisterType <IOperation, NullOperation>(name: "NullOperation"); builder.RegisterType <IAppEventHandler, ScheduleAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType <IAppEventHandler, OracleBLToolkitDataEventHandler>(name: "BLToolkitDataEventHandler"); builder.RegisterType <IDbProvider, OracleDbProvider>(); builder.RegisterType <ISqlFileExecutor, SqlFileExecutor>(); builder.RegisterFactory <IDataContext, DataContextFactory>(); builder.RegisterGeneric(typeof(IRepository <>), typeof(DataContextRepository <>)); }
public void Load(IIocBuilder builder) { builder.RegisterType<IAppEventHandler, OracleBLToolkitDataEventHandler>(name: "BLToolkitDataEventHandler"); builder.RegisterType<IDbProvider, OracleDbProvider>(); builder.RegisterType<ISqlFileExecutor, SqlFileExecutor>(); builder.RegisterFactory<IDataContext, DataContextFactory>(); builder.RegisterGeneric(typeof(IRepository<>), typeof(DataContextRepository<>)); }
public void Load(IIocBuilder builder) { builder.RegisterType<Core.Template.ITemplateEngine, Core.Template.DefaultTemplateEngine>(name: "DefaultTemplateEngine"); builder.RegisterType<Core.Template.ITemplateGenerator, RazorContentTemplateGenerator>(name: "RazorContentTemplateGenerator"); builder.RegisterType<Core.Template.ITemplateProvider, Core.Template.FileTemplateProvider>(name: "FileTemplateProvider", getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("root", "~/Templates"); return paras; }); }
public void Load(IIocBuilder builder) { builder.RegisterType <Core.Template.ITemplateEngine, Core.Template.DefaultTemplateEngine>(name: "DefaultTemplateEngine"); builder.RegisterType <Core.Template.ITemplateGenerator, RazorContentTemplateGenerator>(name: "RazorContentTemplateGenerator"); builder.RegisterType <Core.Template.ITemplateProvider, Core.Template.FileTemplateProvider>(name: "FileTemplateProvider", getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("root", "~/Templates"); return(paras); }); }
public void Load(IIocBuilder builder) { //builder.RegisterType<Core.Configurations.IConfigurationProvider, Configurations.AreaConfigurationProvider>(); builder.RegisterType <Core.Localization.ILocalizer, Localization.JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("paths", "Localization, Areas/*/Localization"); return(paras); }); builder.RegisterType <IAppEventHandler, WebMvcAppEventHandler>(); }
public void Load(IIocBuilder builder) { //builder.RegisterType<Core.Configurations.IConfigurationProvider, Configurations.AreaConfigurationProvider>(); builder.RegisterType<Core.Localization.ILocalizer, Localization.JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("paths", "Localization, Areas/*/Localization"); return paras; }); builder.RegisterType<IAppEventHandler, WebMvcAppEventHandler>(); }
public static void RegisterType <IT, TT>(this IIocBuilder builder, LifeTimeScope scope = LifeTimeScope.Transient, string name = null, bool autoWire = false, Func <IIocContext, IDictionary <string, object> > getConstructorParameters = null, Func <IIocContext, TT, TT> onActivating = null, Action <IIocContext, TT> onActivated = null) where TT : class, IT { Func <IIocContext, object, object> onObjActivaing = null; Action <IIocContext, object> onObjActivated = null; if (onActivating != null) { onObjActivaing = (ctx, obj) => { var nobj = onActivating(ctx, (TT)obj); return(nobj); }; } if (onActivated != null) { onObjActivated = (ctx, obj) => { onActivated(ctx, (TT)obj); }; } builder.RegisterType(typeof(IT), typeof(TT), scope, name, autoWire, getConstructorParameters, onObjActivaing, onObjActivated); }
public void Register(IIocBuilder builder, Type type) { if (!type.IsAbstract && type.IsClass && typeof(IStartup).IsAssignableFrom(type)) { builder.RegisterType(typeof(IStartup), type, LifeTimeScope.Transient, type.FullName); } }
public void Register(IIocBuilder builder, Type type) { if (!type.IsAbstract && type.IsClass && typeof(ICommand).IsAssignableFrom(type)) { builder.RegisterType(typeof(ICommand), type, LifeTimeScope.Transient, type.FullName); } }
public void Load(IIocBuilder builder) { builder.RegisterType<IObjectProvider<SSOServer>, WebJsonFileObjectProvider<SSOServer>>(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("jsonFile", "~/App_Data/sso_server.js"); return paras; }); builder.RegisterType<IObjectProvider<SSOClient[]>, WebJsonFileObjectProvider<SSOClient[]>>(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("jsonFile", "~/App_Data/sso_clients.js"); return paras; }); builder.RegisterType<IObjectProvider<SSOClient>, WebJsonFileObjectProvider<SSOClient>>(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("jsonFile", "~/App_Data/sso_client.js"); return paras; }); builder.RegisterType<ISSOConfiguration, DefaultSSOConfiguration>(LifeTimeScope.Singleton); builder.RegisterType<Server.ISSOServerProvider, SSOServerProvider>(LifeTimeScope.Singleton); builder.RegisterType<Client.ISSOClientProvider, SSOClientProvider>(LifeTimeScope.Singleton); builder.RegisterType<Client.IDefaultSessionProvider, Client.DefaultSessionProvider>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType <IObjectProvider <SSOServer>, WebJsonFileObjectProvider <SSOServer> >(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("jsonFile", "~/App_Data/sso_server.js"); return(paras); }); builder.RegisterType <IObjectProvider <SSOClient[]>, WebJsonFileObjectProvider <SSOClient[]> >(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("jsonFile", "~/App_Data/sso_clients.js"); return(paras); }); builder.RegisterType <IObjectProvider <SSOClient>, WebJsonFileObjectProvider <SSOClient> >(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("jsonFile", "~/App_Data/sso_client.js"); return(paras); }); builder.RegisterType <ISSOConfiguration, DefaultSSOConfiguration>(LifeTimeScope.Singleton); builder.RegisterType <Server.ISSOServerProvider, SSOServerProvider>(LifeTimeScope.Singleton); builder.RegisterType <Client.ISSOClientProvider, SSOClientProvider>(LifeTimeScope.Singleton); builder.RegisterType <Client.IDefaultSessionProvider, Client.DefaultSessionProvider>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType <IJsonSerializer, JsonNetSerializer>( getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("preserveReferencesHandling", PreserveReferencesHandling.None); return(paras); }); }
public void Load(IIocBuilder builder) { builder.RegisterType<IJsonSerializer, JsonNetSerializer>( getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("preserveReferencesHandling", PreserveReferencesHandling.None); return paras; }); }
public static void RegisterConfig(this IIocBuilder builder, XElement root) { var compEles = root.Element("components").Elements("component"); foreach (var ele in compEles) { var serviceType = Type.GetType(ele.Attribute("type").Value); var interfaceType = Type.GetType(ele.Attribute("service").Value); LifeTimeScope scope = LifeTimeScope.Transient; if (ele.Attribute("scope") != null) { switch (ele.Attribute("scope").Value.ToLower()) { case "singleton": scope = LifeTimeScope.Singleton; break; case "workunit": scope = LifeTimeScope.WorkUnit; break; case "transiant": default: scope = LifeTimeScope.Transient; break; } } bool autoWire = ele.AttributeValue <bool>("autowire", false); string name = ele.AttributeValue("name", null); Func <IIocContext, IDictionary <string, object> > getConstructorParameters = null; if (ele.HasElements) { var paraEles = ele.Element("parameters").Elements("parameter"); Dictionary <string, object> paras = new Dictionary <string, object>(); foreach (var pele in paraEles) { paras.Add(pele.Attribute("name").Value, pele.Attribute("value").Value); } getConstructorParameters = (ctx) => { return(paras); }; } builder.RegisterType(interfaceType, serviceType, scope, name, autoWire, getConstructorParameters); } var moduleEles = root.Element("modules").Elements("module"); foreach (var ele in moduleEles) { var moduleType = Type.GetType(ele.Attribute("type").Value); IIocModule module = Activator.CreateInstance(moduleType) as IIocModule; builder.RegisterModule(module); } }
public void Register(IIocBuilder builder, Type type) { if (!type.IsAbstract && type.IsClass) { var itypes = type.GetInterfaces(); if (itypes != null && itypes.Length > 0) { var itype = type.GetInterfaces()[0]; if (itype.IsGenericType && itype.GetGenericTypeDefinition().Equals(typeof(IMessageMapper <>))) { builder.RegisterType(itype, type, LifeTimeScope.Transient, type.FullName); } } } }
public void Register(IIocBuilder builder, Type type) { if (!type.IsAbstract && type.IsClass) { var itypes = type.GetInterfaces(); if (itypes != null && itypes.Length > 0) { var itype = type.GetInterfaces()[0]; if (itype.IsGenericType && itype.GetGenericTypeDefinition().Equals(typeof(IMessageMapper<>))) { builder.RegisterType(itype, type, LifeTimeScope.Transient, type.FullName); } } } }
public void Load(IIocBuilder builder) { builder.RegisterType <ModelMetadataProvider, DataAnnotationsModelMetadataProvider2>(LifeTimeScope.Singleton); builder.RegisterType <IAppEventHandler, WebApiAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType<Core.FileSystem.IFileSystemProvider, Core.FileSystem.LocalFileProvider>(name: "LocalFileSystem"); builder.RegisterType<Core.Caching.ICacheManager, Caching.WebCacheManager>(); builder.RegisterType<Core.Security.IPasswordEncryptionProvider, Core.Security.HashEncryptionProvider>(LifeTimeScope.Singleton); builder.RegisterType<Core.Generators.IRandomTextGenerator, Core.Generators.RNGRandomTextGenerator>(LifeTimeScope.Singleton); builder.RegisterType<Core.Generators.IIdGenerator, Core.Generators.TicksIdGenerator>(LifeTimeScope.Singleton); #if DEBUG builder.RegisterType<Core.Data.ITransactionManager, Core.Data.NullTransactionManager>(); #else builder.RegisterType<Core.Data.ITransactionManager, Core.Data.DefaultTransactionManager>(); #endif builder.RegisterType<Security.ICaptchaGenerator, Security.DefaultCaptchaGenerator>(LifeTimeScope.Singleton); builder.RegisterType<Core.Serialization.IJsonSerializer, Serialization.JavascriptConvert>(LifeTimeScope.Singleton); builder.RegisterType<IObjectProvider<IEnumerable<DAF.Core.Localization.LocalizationInfo>>, WebJsonFileObjectProvider<IEnumerable<DAF.Core.Localization.LocalizationInfo>>>(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("jsonFile", "~/App_Data/languages.js"); return paras; }); builder.RegisterType<IObjectProvider<IEnumerable<Menu.MenuGroup>>, WebJsonFileObjectProvider<IEnumerable<Menu.MenuGroup>>>(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("jsonFile", "~/App_Data/menu.js"); return paras; }); builder.RegisterType<Core.Localization.ILocalizer, Localization.JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("paths", "Localization"); return paras; }); //builder.RegisterType<Core.Logging.ILogger, Core.Logging.NullLogger>(LiftTimeScope.Singleton, autoWire: true); builder.RegisterType<IWebAppEventHandler, IOC.IocWebAppEventHandler>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType<IMessageSender, NBusSender>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType <IMessageSender, NBusSender>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType<ISqlFileExecutor, SqlFileExecutor>(); builder.RegisterFactory<MongoDatabase, DatabaseFactory>(); builder.RegisterGeneric(typeof(IRepository<>), typeof(CollectionRepository<>)); }
public void Load(IIocBuilder builder) { builder.RegisterType<Core.Configurations.IConfigurationProvider, Configurations.ModuleConfigurationProvider>(); builder.RegisterType<Core.Localization.ILocalizer, JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("paths", "Localization, Modules/*/Localization"); return paras; }); builder.RegisterType<IObjectProvider<IEnumerable<DAF.Web.Menu.MenuGroup>>, ModuleMenuGroupProvider>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("paths", "App_Data, Modules/*/App_Data"); paras.Add("fileName", "menu.js"); return paras; }); builder.RegisterType<IAppSettingProvider, AppSettingProvider>(LifeTimeScope.Singleton); builder.RegisterType<IBasicDataProvider, BasicDataProvider>(LifeTimeScope.Singleton); builder.RegisterType<ICategoryProvider, CategoryProvider>(LifeTimeScope.Singleton); builder.RegisterType<IContentProvider, ContentProvider>(LifeTimeScope.Singleton); builder.RegisterType<IWebSiteProvider, WebSiteProvider>(LifeTimeScope.Singleton); builder.RegisterType<IPageTemplateProvider, PageTemplateProvider>(LifeTimeScope.Singleton); builder.RegisterType<IMenuProvider, MenuProvider>(LifeTimeScope.Singleton); builder.RegisterType<IUserGroupProvider, UserGroupProvider>(LifeTimeScope.Singleton); builder.RegisterType<ITemplateTypeProvider, TemplateTypeProvider>(LifeTimeScope.Singleton); builder.RegisterType<IWidgetTypeProvider, WidgetTypeProvider>(LifeTimeScope.Singleton); builder.RegisterType<IPageProvider, PageProvider>(LifeTimeScope.Singleton); builder.RegisterType<IAppEventHandler, CmsAppEventHandler>(); builder.RegisterType<DAF.SSO.Client.IDefaultSessionProvider, CmsDefaultSessionProvider>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterGeneric(typeof(IRepositoryEventHandler<>), typeof(SearchRepositoryEventHandler<>)); builder.RegisterType<IAppEventHandler, SearchAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType <Core.FileSystem.IFileSystemProvider, Core.FileSystem.LocalFileProvider>(name: "LocalFileSystem"); builder.RegisterType <Core.Caching.ICacheManager, Caching.WebCacheManager>(); builder.RegisterType <Core.Security.IPasswordEncryptionProvider, Core.Security.HashEncryptionProvider>(LifeTimeScope.Singleton); builder.RegisterType <Core.Generators.IRandomTextGenerator, Core.Generators.RNGRandomTextGenerator>(LifeTimeScope.Singleton); builder.RegisterType <Core.Generators.IIdGenerator, Core.Generators.TicksIdGenerator>(LifeTimeScope.Singleton); #if DEBUG builder.RegisterType <Core.Data.ITransactionManager, Core.Data.NullTransactionManager>(); #else builder.RegisterType <Core.Data.ITransactionManager, Core.Data.DefaultTransactionManager>(); #endif builder.RegisterType <Security.ICaptchaGenerator, Security.DefaultCaptchaGenerator>(LifeTimeScope.Singleton); builder.RegisterType <Core.Serialization.IJsonSerializer, Serialization.JavascriptConvert>(LifeTimeScope.Singleton); builder.RegisterType <IObjectProvider <IEnumerable <DAF.Core.Localization.LocalizationInfo> >, WebJsonFileObjectProvider <IEnumerable <DAF.Core.Localization.LocalizationInfo> > >(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("jsonFile", "~/App_Data/languages.js"); return(paras); }); builder.RegisterType <IObjectProvider <IEnumerable <Menu.MenuGroup> >, WebJsonFileObjectProvider <IEnumerable <Menu.MenuGroup> > >(LifeTimeScope.Singleton, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("jsonFile", "~/App_Data/menu.js"); return(paras); }); builder.RegisterType <Core.Localization.ILocalizer, Localization.JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("paths", "Localization"); return(paras); }); //builder.RegisterType<Core.Logging.ILogger, Core.Logging.NullLogger>(LiftTimeScope.Singleton, autoWire: true); builder.RegisterType <IWebAppEventHandler, IOC.IocWebAppEventHandler>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterGeneric(typeof(IRepositoryEventHandler <>), typeof(SearchRepositoryEventHandler <>)); builder.RegisterType <IAppEventHandler, SearchAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType<ModelMetadataProvider, DataAnnotationsModelMetadataProvider2>(LifeTimeScope.Singleton); builder.RegisterType<IAppEventHandler, WebApiAppEventHandler>(); }
public void Load(IIocBuilder builder) { builder.RegisterType <Core.Configurations.IConfigurationProvider, Configurations.ModuleConfigurationProvider>(); builder.RegisterType <Core.Localization.ILocalizer, JsonLocalizer>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("paths", "Localization, Modules/*/Localization"); return(paras); }); builder.RegisterType <IObjectProvider <IEnumerable <DAF.Web.Menu.MenuGroup> >, ModuleMenuGroupProvider>(LifeTimeScope.Singleton, autoWire: true, getConstructorParameters: (ctx) => { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("paths", "App_Data, Modules/*/App_Data"); paras.Add("fileName", "menu.js"); return(paras); }); builder.RegisterType <IAppSettingProvider, AppSettingProvider>(LifeTimeScope.Singleton); builder.RegisterType <IBasicDataProvider, BasicDataProvider>(LifeTimeScope.Singleton); builder.RegisterType <ICategoryProvider, CategoryProvider>(LifeTimeScope.Singleton); builder.RegisterType <IContentProvider, ContentProvider>(LifeTimeScope.Singleton); builder.RegisterType <IWebSiteProvider, WebSiteProvider>(LifeTimeScope.Singleton); builder.RegisterType <IPageTemplateProvider, PageTemplateProvider>(LifeTimeScope.Singleton); builder.RegisterType <IMenuProvider, MenuProvider>(LifeTimeScope.Singleton); builder.RegisterType <IUserGroupProvider, UserGroupProvider>(LifeTimeScope.Singleton); builder.RegisterType <ITemplateTypeProvider, TemplateTypeProvider>(LifeTimeScope.Singleton); builder.RegisterType <IWidgetTypeProvider, WidgetTypeProvider>(LifeTimeScope.Singleton); builder.RegisterType <IPageProvider, PageProvider>(LifeTimeScope.Singleton); builder.RegisterType <IAppEventHandler, CmsAppEventHandler>(); builder.RegisterType <DAF.SSO.Client.IDefaultSessionProvider, CmsDefaultSessionProvider>(LifeTimeScope.Singleton); }
public void Load(IIocBuilder builder) { builder.RegisterType <ISqlFileExecutor, SqlFileExecutor>(); builder.RegisterFactory <MongoDatabase, DatabaseFactory>(); builder.RegisterGeneric(typeof(IRepository <>), typeof(CollectionRepository <>)); }