标签:nodename static services div 同步数据 cep sql 文件 建立
1、同步数据库时这个要注释掉
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))] 这句话去掉注释
编译运行程序时要注释掉,不然报错!
/// <summary> /// 客户实体 /// </summary> // [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))] public class CustomerEntities : DbContext, IRequest { static CustomerEntities() { DbInterception.Add(new EfIntercepter()); } /// <summary> /// 仅用于数据迁移 /// </summary> public CustomerEntities() : base("server=192.168.99.62;user=user_1;password=123;database=Customer.Service.Db;port=3306;Charset=utf8;") { } public CustomerEntities(DbConnection existingConnection) : base(existingConnection, true) { } public string RequestId { get; set; } public string FirstRequestId { get; set; } public string NodeName { get; set; } public int MvcUserId { get; set; } public DbSet<TCustomer> TCustomers { get; set; } public DbSet<TCustomerBusiness> TCustomerBusinesss { get; set; } public DbSet<TCustomerService> TCustomerServices { get; set; } public DbSet<TServiceType> TServiceTypes { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); } }
2、改数据库的话要改文档,不能直接改库
add-miguration 生成模型
Update-Database -Force –TargetMigration: $InitialDatabase 强制删除
Add-Migration -Force 强制重新建立添加库的cs文件
每次改动先运行 add-miguration 再运行 Update-Database
标签:nodename static services div 同步数据 cep sql 文件 建立
原文地址:http://www.cnblogs.com/demonyx/p/6857704.html