当前位置: 首页>>代码示例>>C#>>正文


C# IConfiguration.AddProfile方法代码示例

本文整理汇总了C#中IConfiguration.AddProfile方法的典型用法代码示例。如果您正苦于以下问题:C# IConfiguration.AddProfile方法的具体用法?C# IConfiguration.AddProfile怎么用?C# IConfiguration.AddProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfiguration的用法示例。


在下文中一共展示了IConfiguration.AddProfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureAutoMapper

        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 映射完成");
        }
开发者ID:zidanfei,项目名称:Dot.Utility,代码行数:25,代码来源:AutomapperTypeAdapterFactory.cs

示例2: BuildAutoMapperConfiguration

 private static void BuildAutoMapperConfiguration(IConfiguration configuration, IEnumerable<Profile> profiles)
 {
     foreach (var profile in profiles)
     {
         configuration.AddProfile(profile);
     }
 }
开发者ID:odw1,项目名称:Random-Stuff,代码行数:7,代码来源:AutoMapperConfiguration.cs

示例3: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration)
 {
     var profiles = typeof(AutomapperConfiguration).Assembly.GetTypes().Where(x => typeof(AutoMapper.Profile).IsAssignableFrom(x));
     foreach (var profile in profiles)
     {
         configuration.AddProfile(Activator.CreateInstance(profile) as AutoMapper.Profile);
     }
 }
开发者ID:Joefrank,项目名称:fromplaytobow.co.uk,代码行数:8,代码来源:AutomapperConfiguration.cs

示例4: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration)
 {
     var profiles = typeof(IApplicationService).Assembly.GetTypes().Where(x => typeof(Profile).IsAssignableFrom(x));
     foreach (var profile in profiles)
     {
         configuration.AddProfile(Activator.CreateInstance(profile) as Profile);
     }
 }
开发者ID:kipwilliams,项目名称:Find.Me,代码行数:8,代码来源:AutoMapperConfiguration.cs

示例5: GetConfiguration

 private void GetConfiguration(IConfiguration configuration)
 {
     var profiles = typeof(DefaultProfileMapper).Assembly.GetTypes().Where(x => typeof(Profile).IsAssignableFrom(x));
     foreach (var profile in profiles)
     {
         configuration.AddProfile(Activator.CreateInstance(profile) as Profile);
     }
 }
开发者ID:LazyAbstract,项目名称:AReportes,代码行数:8,代码来源:MapperConfiguration.cs

示例6: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration)
 {
     var assembly = typeof(AutoMapperWebConfiguration).GetTypeInfo().Assembly;
     var exportedTypes = assembly.GetExportedTypes();
     foreach (var type in exportedTypes.Where(a => typeof(Profile).IsAssignableFrom(a)))
     {
         configuration.AddProfile(Activator.CreateInstance(type) as Profile);
     }
 }
开发者ID:freemsly,项目名称:MVC6-Awakens,代码行数:9,代码来源:AutoMapperWebConfiguration.cs

示例7: GetConfigurationFromAssembly

        private static void GetConfigurationFromAssembly(IConfiguration cfg)
        {
            var profiles = typeof(PersonProfile).Assembly
                .GetTypes()
                .Where(t => t != typeof(Profile) && typeof(Profile).IsAssignableFrom(t));

            foreach (var profile in profiles)
            {
                cfg.AddProfile((Profile)Activator.CreateInstance(profile));
            }
        }
开发者ID:jonsagara,项目名称:AddressForm,代码行数:11,代码来源:AutoMapperConfig.cs

示例8: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration, IEnumerable<Assembly> assemblies)
 {
     foreach (var assembly in assemblies)
     {
         var profiles = assembly.GetTypes().Where(x => typeof(Profile).IsAssignableFrom(x));
         foreach (var profile in profiles)
         {
             configuration.AddProfile(Activator.CreateInstance(profile) as Profile);
         }
     }
 }
开发者ID:martinobordin,项目名称:BusinessLight,代码行数:11,代码来源:AutoMapperConfiguration.cs

示例9: GetConfiguration

        // Using Reflection load all the profiles which contain the AutoMapper configuration
        // from entities to view models visa versa
        // to be used if applying ViewModels in a mature application so that entity models are not
        // tighly coupled to the UI layer
        private static void GetConfiguration(IConfiguration configuration)
        {
            configuration.AllowNullDestinationValues = true;
            configuration.AllowNullCollections = true;

            IEnumerable<Type> profiles = Assembly.GetExecutingAssembly().GetTypes().Where(type => typeof(Profile).IsAssignableFrom(type));

            foreach (var profile in profiles)
            {
                configuration.AddProfile(Activator.CreateInstance(profile) as Profile);
            }
        }
开发者ID:pjmagee,项目名称:DemoExercise,代码行数:16,代码来源:AutoMapperConfig.cs

示例10: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration)
 {
     var assemblies = AppDomain.CurrentDomain.GetAssemblies();
     foreach (var assembly in assemblies)
     {
         var profiles = assembly.GetTypes().Where(x => x != typeof(Profile) && typeof(Profile).IsAssignableFrom(x));
         foreach (var profile in profiles)
         {
             configuration.AddProfile((Profile)Activator.CreateInstance(profile));
         }
     }
 }
开发者ID:thanhtoan252,项目名称:Simple-CMS,代码行数:12,代码来源:AutoMapperConfiguration.cs

示例11: GetConfiguration

        private static void GetConfiguration(IConfiguration configuration, ContainerBuilder builder)
        {
            var profileTypes = typeof(AutoMapperConfiguration).Assembly.GetTypes().Where(type =>
                    type.ContainsGenericParameters == false &&
                    typeof(Profile).IsAssignableFrom(type));

            foreach (var profileType in profileTypes)
            {
                var profile = Activator.CreateInstance(profileType) as Profile;
                configuration.AddProfile(profile);
                builder.RegisterInstance(profile).AsImplementedInterfaces().SingleInstance();
            }
        }
开发者ID:thomasgalliker,项目名称:EmployeeManagement,代码行数:13,代码来源:AutoMapperConfiguration.cs

示例12: AddProfile

        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        /// <param name="assembly"></param>
        private static void AddProfile(IConfiguration config, Assembly assembly)
        {
            foreach (var type in assembly.GetTypes())
            {
                if (type.IsAbstract || type.IsInterface) 
                {
                    continue;
                }

                if (typeof(Profile).IsAssignableFrom(type))
                {
                    config.AddProfile(Activator.CreateInstance(type) as Profile);
                }
            }            
        }
开发者ID:XyPis,项目名称:Xy.Pis.Framework-RC,代码行数:20,代码来源:AutoMapperBootStrapper.cs

示例13: GetAutoMapperConfiguration

        private void GetAutoMapperConfiguration(IConfiguration configuration, IWindsorContainer container)
        {
            var registrar = container.Resolve<AssemblyRegistrar>();
            using (var childContainer = new WindsorContainer())
            {
                Action<Assembly> action =
                    asm =>
                        childContainer.Register(Types.FromAssembly(asm)
                            .BasedOn<Profile>()
                            .WithServices(typeof(Profile)));
                action.VisitAssemblies(registrar);

                foreach (var profile in childContainer.ResolveAll<Profile>())
                    configuration.AddProfile(profile);
            }
        }
开发者ID:Grinderofl,项目名称:Tracker,代码行数:16,代码来源:ProfileInstaller.cs

示例14: GetConfiguration

 private static void GetConfiguration(IConfiguration configuration, IEnumerable<Assembly> assemblies)
 {
     assemblies = assemblies
         //?? AppDomain.CurrentDomain.GetAssemblies()
         ?? new[] { Assembly.GetExecutingAssembly() }
     ;
     foreach (var assembly in assemblies)
     {
         var profileClasses = assembly.GetTypes()
             .Where(t => t != typeof(Profile) && typeof(Profile).IsAssignableFrom(t))
             .ToArray()
         ;
         foreach (var profileClass in profileClasses)
         {
             configuration.AddProfile((Profile)Activator.CreateInstance(profileClass));
         }
     }
 }
开发者ID:saibalghosh,项目名称:UCosmic,代码行数:18,代码来源:AutoMapperRegistration.cs

示例15: GetConfiguration

        private static void GetConfiguration(IEnumerable<Assembly> assemblies, IConfiguration configuration)
        {
            var types = new List<Type>();

            foreach (var thisAssembly in assemblies)
            {
                types.AddRange(thisAssembly.GetTypes());
            }

            var profiles = types.Where(x => typeof(Profile).IsAssignableFrom(x));

            foreach (var profile in profiles)
            {
                configuration.AddProfile(Activator.CreateInstance(profile) as Profile);
            }

            Mapper.AssertConfigurationIsValid();
        }
开发者ID:TeardropDucky,项目名称:ITTWEB,代码行数:18,代码来源:MappingConfiguration.cs


注:本文中的IConfiguration.AddProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。