Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework 实体框架查看错误的数据库_Entity Framework_Asp.net Web Api_Sql Server 2012_Entity Framework Migrations - Fatal编程技术网

Entity framework 实体框架查看错误的数据库

Entity framework 实体框架查看错误的数据库,entity-framework,asp.net-web-api,sql-server-2012,entity-framework-migrations,Entity Framework,Asp.net Web Api,Sql Server 2012,Entity Framework Migrations,VS2013 WebAPI 2.x with Repository突然开始寻找在数据库实例上发生的数据迁移,而不是它在过去3个月内一直使用的数据库实例—EF版本6 我的SQL Server 2012(v11.0.2218.0)版本为hp\localdb——这已经接受了12次迁移,并使用添加迁移/更新数据库命令进行了3个月的迁移 从昨天开始:更新数据库会产生这样的消息 PM> update-database -verbose Using StartUp project 'PartyPooc

VS2013 WebAPI 2.x with Repository突然开始寻找在数据库实例上发生的数据迁移,而不是它在过去3个月内一直使用的数据库实例—EF版本6

我的SQL Server 2012(v11.0.2218.0)版本为hp\localdb——这已经接受了12次迁移,并使用添加迁移/更新数据库命令进行了3个月的迁移

从昨天开始:更新数据库会产生这样的消息

PM> update-database -verbose 
Using StartUp project 'PartyPoochesClient'.
Using NuGet project 'PartyPooches.Repository'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Target database is: 'PartyPooches.Repository.Entities.PartyPoochesContext' (***DataSource: (localdb)\v12.0,*** Provider: System.Data.SqlClient, Origin: Convention).
我从未有过v12.0的实例,直到昨天的迁移/
更新数据库
尝试时,PM才希望看到
(localdb)\v12.0
接受更新。在整个解决方案中搜索
(localdb)\v12.0
的任何代码都不会产生任何结果。正如预期的那样,由于SQL Server错误50无法定位这样一个实例,项目使用CodeFirst创建的DB几乎对
ron hp\localdb
实例进行了12次迁移更新,没有问题

守则:

internal sealed class Configuration : DbMigrationsConfiguration<PartyPooches.Repository.Entities.PartyPoochesContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;
        ContextKey = "PartyPooches.Repository.Entities.PartyPoochesContext";
    }

    protected override void Seed(PartyPooches.Repository.Entities.PartyPoochesContext context)
内部密封类配置:dbmigtorinsconfiguration
{
公共配置()
{
AutomaticMiggerationsEnabled=假;
ContextKey=“PartyPooches.Repository.Entities.PartyPoochesContext”;
}
受保护的覆盖无效种子(PartyBooks.Repository.Entities.PartyPoochesContext上下文)
配置:

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
    <parameters>
      <parameter value="Data Source=ron-hp\localdb;Initial Catalog=PartyPooches.Repository.PartyPoochesContext; user=xxxxx;password=xxxxx; MultipleActiveResultSets=True;App=EntityFramework"/>
    </parameters>
  </defaultConnectionFactory>
  <providers>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
  </providers>
</entityFramework>

数据库上下文

public class PartyPoochesContext : DbContext, IDisposable
{
    public DbSet<Dog> Dogs { get; set; }
    public DbSet<Handler> Handlers { get; set; }
    public DbSet<Skill> Skills { get; set; }
    public DbSet<DogType> DogTypes { get; set; }
    public DbSet<Schedule> Schedules { get; set; }
    public DbSet<Appointment> Appointments { get; set; }
    public DbSet<PaymentType> PaymentTypes { get; set; }
    public DbSet<Customer> Customers { get; set; }
public类PartyPoochesContext:DbContext,IDisposable
{
公共数据库集狗{get;set;}
公共数据库集处理程序{get;set;}
公共数据库集技能{get;set;}
公共DbSet DogTypes{get;set;}
公共数据库集调度{get;set;}
公共数据库集约会{get;set;}
公共DbSet PaymentTypes{get;set;}
公共数据库集客户{get;set;}
上述设置显示此SQL Server 2012实例已有3个月了


未对设置进行任何更改,但最近的实体更改已针对一个较小的数据库更新实施,该更新现在正在查找一个不存在的SQL Server实例。到昨天为止,该实例在3个月内完美无缺。找不到任何处理此问题的基于internet的信息。行为类似于某个NuGet软件包滑入了某些内容,但没有确定n其中。

问题来源的关键在这里:
来源:约定
在web.config中的
键之外还有哪些其他连接字符串?