Пример #1
0
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer <EntityDbContext>(null);

            var types = AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(assembly => assembly.GetTypes())
                        .Where(type => type.IsSubclassOf(typeof(BaseModel)));

            foreach (var type in types)
            {
                BaseModel.Build(modelBuilder, type);
            }

            base.OnModelCreating(modelBuilder);
        }