Esempio n. 1
0
        private MapperConfiguration CreateMapperConfiguration()
        {
            profileDiscovery.DiscoverProfiles();
            profileDiscovery.GetProfiles();

            var config = new MapperConfiguration(configExpression =>
            {
                configExpression.AddExpressionMapping();
                configExpression.ConstructServicesUsing(type => serviceLocator.Get(type));

                var profiles = profileDiscovery.GetProfiles();
                foreach (Profile profile in profiles)
                {
                    configExpression.AddProfile(profile);
                }
            });

            return(config);
        }
Esempio n. 2
0
        public void Configure()
        {
            Mapper.Initialize(config =>
            {
                config.AddExpressionMapping();

                if (AutoDiscoverAutoMapperProfiles)
                {
                    profileDiscovery.DiscoverProfiles();
                }

                var profiles = profileDiscovery.GetProfiles();
                foreach (Profile profile in profiles)
                {
                    config.AddProfile(profile);
                }
            });
        }