예제 #1
0
        private static void AddMappings(Configuration cfg, IEnumerable <Type> types)
        {
            var mapper = new ModelMapper();

            mapper.AddConventions();
            mapper.AddMappings(types);

            var hbm = mapper.CompileMappingForAllExplicitlyAddedEntities();

            hbm.autoimport  = true;
            hbm.defaultlazy = Alma.Common.Config.Settings.EnableLazyLoad;

            cfg.AddMapping(hbm);
            if (Alma.Common.Config.Settings.ExecuteMigrations)
            {
                cfg.AddSchemaValidationAndMigration();
            }
        }