private void ConfigureAutoMapper(IMapperConfigurationExpression cfg)
        {
            ////AutoMapper Help
            ////https://github.com/AutoMapper/AutoMapper/wiki
            ////http://www.rqna.net/qna/yxzrz-automapper-bidirectional-mapping-with-reversemap-and-formember.html

            //基类执行程序集搜索、Mappter 初始化。
            //scan all assemblies finding Automapper Profile
            var profiles = DotEnvironment.GetAppPlugins()
                           .SelectMany(p => p.Assembly.GetTypes())
                           .Where(t => t.BaseType == typeof(AutoMapper.Profile))
                           .Distinct().ToList();

            foreach (var item in profiles)
            {
                //cfg.AddProfile(Activator.CreateInstance(item) as AutoMapper.Profile);
                cfg.AddProfile(item);
            }

            //            Mapper.Initialize(cfg =>
            //     cfg.AddProfiles(new[] {
            //        typeof(HomeController),
            //        typeof(Entity)
            //     });
            //);

            Dot.Log.LogFactory.PlatformLog.Debug("Domain Dto 映射完成");
        }
Exemplo n.º 2
0
        internal static string GetConfigPath()
        {
            var    serverSettingsPath = ConfigHelper.GetAppSettingOrDefault("ServerSettingsPath", "Config");
            string ConfigPath         = DotEnvironment.MapAbsolutePath(serverSettingsPath);

            return(ConfigPath);
        }
        private void ConfigureAutoMapper(IConfiguration cfg)
        {
            //AutoMapper Help
            //https://github.com/AutoMapper/AutoMapper/wiki
            //http://www.rqna.net/qna/yxzrz-automapper-bidirectional-mapping-with-reversemap-and-formember.html

            //基类执行程序集搜索、Mappter 初始化。
            //scan all assemblies finding Automapper Profile
            var profiles = DotEnvironment.GetAppPlugins()
                           .SelectMany(p => p.Assembly.GetTypes())
                           .Where(t => t.BaseType == typeof(AutoMapper.Profile))
                           .Distinct().ToList();

            foreach (var item in profiles)
            {
                cfg.AddProfile(Activator.CreateInstance(item) as AutoMapper.Profile);
            }

            var maps = Mapper.GetAllTypeMaps();

            foreach (var map in maps)
            {
            }

            Dot.Utility.Log.LogFactory.PlatformLog.Debug("Domain Dto 映射完成");
        }
Exemplo n.º 4
0
        public void ExportDTtoExcelTest()
        {
            string filePath = DotEnvironment.MapAbsolutePath("AIS_SyncConfig.xls");

            Compare2(filePath);
            filePath = DotEnvironment.MapAbsolutePath("AIS_SyncConfig.xlsx");
            Compare2(filePath);
        }
Exemplo n.º 5
0
        internal static string GetConfigPath()
        {
            //throw new NotImplementedException();
            var    serverSettingsPath = ConfigHelper.GetAppSettingOrDefault("ServerSettingsPath", "Config");
            string ConfigPath         = DotEnvironment.MapAbsolutePath(serverSettingsPath);

            return(ConfigPath);
        }
Exemplo n.º 6
0
        public void ImportExceltoDtTest()
        {
            DataTable table = ExcelHelper.ImportExceltoDt(DotEnvironment.MapDllPath(@"config\AIS_SyncConfig.xlsx"), "BD_Properties", 0);

            Assert.AreEqual("Type", table.Columns[0].ColumnName);
            Assert.AreEqual("PropertyName", table.Columns[0].ColumnName);
            Assert.AreEqual("Description", table.Columns[0].ColumnName);
            Assert.AreEqual("cnDescription", table.Columns[0].ColumnName);
            Assert.AreEqual("IsEnabled", table.Columns[0].ColumnName);
            Assert.AreEqual("NeedUpdate", table.Columns[0].ColumnName);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 注册指定程序集中,所有标记了 ExportAttribute 的类型到 IOC 容器中。
        /// 并同时可以指定所需要的拦截器。
        ///
        /// 使用时,应该重写 <see cref="AppImplementationBase.RaiseComposeOperations"/> 方法,并在方法体内调用。
        /// </summary>
        public static void RegisterByAttribute(
            params InjectionMember[] injections
            )
        {
            if (injections == null)
            {
                throw new ArgumentNullException("interceptors");
            }

            var assemblies = DotEnvironment.GetAppPlugins().Select(p => p.Assembly);

            RegisterByAttribute(assemblies, injections);
        }
Exemplo n.º 8
0
        private void LoadAllPlugins()
        {
            var assemblies = DotEnvironment.GetAppPlugins().Select(p => p.Assembly);
            var types      = assemblies.SelectMany(a => a.GetTypes())
                             .Where(t =>
                                    !t.IsAbstract &&
                                    !t.IsInterface &&
                                    !t.IsGenericTypeDefinition &&
                                    t.IsDefined(typeof(ExportAttribute), false)
                                    ).ToArray();

            foreach (var toType in types)
            {
                this.RegisterType(toType);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 初始化所有Plugins
 /// </summary>
 private void InitAllPlugins()
 {
     DotEnvironment.StartupAppPlugins();
 }
Exemplo n.º 10
0
        /// <summary>
        /// 是否有效License
        /// 此方法校验License是否有效,是否过期;
        /// 版本,人数第三系统自己校验
        ///
        /// path默认路径dll文件夹下 config/License.lic
        /// pubKey 使用内置key
        /// </summary>
        /// <returns></returns>
        public static bool IsValidityLicense(out string message)
        {
            string path = DotEnvironment.MapDllPath("config\\License.lic");

            return(IsValidityLicense(path, _pubKey, out message));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 是否有效License
        /// 此方法校验License是否有效,是否过期;是否申请的机器
        /// 版本,人数第三系统自己校验
        /// </summary>
        /// <param name="info"></param>
        /// <param name="certName"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static bool IsValidityLicenseByCert(string certName, out string message)
        {
            LicenseInfo license = XmlHelper.LoadConfig <LicenseInfo>(DotEnvironment.MapDllPath("config\\license.lic"));

            return(IsValidityLicenseByCert(license, certName, out message));
        }