1
我有一個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>
我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; }
}
當我啓用自動遷移IAM越來越錯誤如下
「不支持關鍵字: '密碼:111111; multipleactiveresultsets'。」
有人可以說最新的問題?
你確定'connectionString'是正確的? –
不正確。密碼就像..「密碼=」而不是「密碼:」..愚蠢的粗心的錯誤。 :D – Abhijith