コード例 #1
0
        public void ConfigureDependencies(IDependencyConfiguration config)
        {
            IoC.ConfigureFromResolverInterfaces(Assembly.GetExecutingAssembly());

            IoC.Modules.Add<Application.ApplicationDependencyModule>();
            IoC.Modules.Add<Data.DataDependencyModule>();
            IoC.Modules.Add<Domain.DomainDependencyModule>();
            IoC.Modules.Add<Presentation.PresentationDependencyModule>();
            IoC.Modules.Add<Reports.ReportsDependencyModule>();
        }
コード例 #2
0
        private static IDependencyConfiguration InitializeContainer(ExtensionConfigContext context)
        {
            var configType = context.Config.TypeLocator.GetTypes()
                             .Where(x => typeof(IDependencyConfiguration).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract)
                             .FirstOrDefault();

            IDependencyConfiguration configuration = null;

            if (configType != null)
            {
                var configInstance = Activator.CreateInstance(configType);
                configuration = (IDependencyConfiguration)configInstance;
            }
            return(configuration);
        }
        private static IDependencyConfiguration InitializeContainer(ExtensionConfigContext context)
        {
            var configType = AppDomain.CurrentDomain.GetAssemblies()
                             .SelectMany(x => x.GetTypes())
                             .FirstOrDefault(x =>
                                             typeof(IDependencyConfiguration).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract);

            IDependencyConfiguration configuration = null;

            if (configType == null)
            {
                return(configuration);
            }

            var configInstance = Activator.CreateInstance(configType);

            configuration = (IDependencyConfiguration)configInstance;

            return(configuration);
        }
コード例 #4
0
 public void ConfigureDependencies(IDependencyConfiguration config)
 {
     IoC.ConfigureFromResolverInterfaces(Assembly.GetExecutingAssembly());
 }
 /// <summary>
 /// 依赖组件初始化类构造函数,调用方需继承并实现<see cref="IDependencyConfiguration"/>
 /// 接口作为构造参数
 /// </summary>
 /// <param name="dependencyConfiguration"></param>
 public DependencyComponentInitialization(IDependencyConfiguration dependencyConfiguration)
 {
     _dependencyConfiguration = dependencyConfiguration;
     _dependencyConfiguration.DependencyBindContext = new DependencyBindContext();
 }
コード例 #6
0
 public DI(IDependencyConfiguration configuration)
 {
     this.Configuration = configuration;
 }