Keyword not supported error in Enabling migrations

荒凉一梦 提交于 2020-01-13 07:01:09

问题


I have a dbcontext class where i have initialized 4 dbsets. My connection string is

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

My dbcotext class is

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; }
    }

When i enable automatic migrations iam getting error as follows

"Keyword not supported: 'password:111111; multipleactiveresultsets'."

Can someone say whats the problem?


回答1:


Your Connection String format is wrong, it should be like this

connectionString="Data Source=.; initial catalog=someDb; user ID=ab; Password=111111; MultipleActiveResultSets=True;" 


来源:https://stackoverflow.com/questions/45532177/keyword-not-supported-error-in-enabling-migrations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!