启用迁移中的关键字不支持错误 [英] Keyword not supported error in Enabling migrations

查看:121
本文介绍了启用迁移中的关键字不支持错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

我的dbcotext类是

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

不支持关键字:'密码:111111; multipleactiveresultsets'."

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

有人可以说出什么问题吗?

Can someone say whats the problem?

推荐答案

您的Connection String格式错误,应该是这样

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

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

这篇关于启用迁移中的关键字不支持错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆