启用迁移时出现关键字不支持错误

Abh*_*ith 1 asp.net-mvc entity-framework entity-framework-migrations

我有一个 dbcontext 类,我在其中初始化了 4 个 dbset。我的连接字符串是

  <connectionStrings>
    <add name="somename" connectionString="Data Source=.; initial catalog=someDb; user ID=ab; Password:111111; MultipleActiveResultSets=True;"  providerName="System.Data.SqlClient" />
  </connectionStrings>
Run Code Online (Sandbox Code Playgroud)

我的 dbcotext 类是

public AstroEntities(): base("somename")
        {
            Database.SetInitializer<AstroEntities>(new CreateDatabaseIfNotExists<AstroEntities>());
        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Contact>().ToTable("Contacts");
            modelBuilder.Entity<Appointment>().ToTable("Appointments");
            modelBuilder.Entity<Consultation>().ToTable("Consultations");
            modelBuilder.Entity<HomePageMessage>().ToTable("HomePageMessages");
            base.OnModelCreating(modelBuilder);
        }
        public DbSet<Contact> Contacts { get; set; }
        public DbSet<Appointment> Appointments { get; set; }
        public DbSet<Consultation> Consultations { get; set; }
        public DbSet<HomePageMessage> Homepagemessages { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

当我启用自动迁移时,我收到如下错误

“不支持关键字:‘密码:111111;多个活动结果集’。”

有人能说有什么问题吗?

Kah*_*azi 5

你的Connection String格式不对,应该是这样的

connectionString="Data Source=.; initial catalog=someDb; user ID=ab; Password=111111; MultipleActiveResultSets=True;" 
Run Code Online (Sandbox Code Playgroud)