EF Power Tools Beta 2 - 被调用的目标抛出异常 [英] EF Power Tools Beta 2 - exception has been thrown by the target of an invocation

查看:80
本文介绍了EF Power Tools Beta 2 - 被调用的目标抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有EF 5.0代码优先VS 2012项目和所有实体框架菜单命令(查看实体数据模型DDL SQL)产生异常被调用的目标抛出弹出窗口。我认为还有更改的是EF Power Tools Beta 1(或VS 2010,我不确定)用于在输出窗口中显示EF Power Tools消息。现在我得到的是弹出窗口...这是VS还是Power Tools问题?

解决方案

这是我的工作: / p>

将构造函数注释出来,并保留静态MyDbContext - >

  public class MyDbContext:DbContext 
{
public static string ConnectionName =Name = SMS_ADvTECHContext;
static MyDbContext()
{
Database.SetInitializer< SMS_ADvTECHContext>(null);
}

/ * public SMS_MyDbContext()
:base(ConnectionName)
{
} * /
}

然后如果你右键单击上下文类 - > Enityframework - >查看实体数据模型(只读)它生成视图!


I have EF 5.0 code-first VS 2012 project and all Entity Framework menu commands (View Entity Data Model DDL SQL) produce "Exception has been thrown by the target of an invocation" popup. I think what has also changed is that EF Power Tools Beta 1 (or VS 2010, I am not sure) use to display EF Power Tools messages in the output window. Now all I get is the popup... Is this VS or Power Tools issue?

解决方案

this is my work around:

Comment the constructor out, and leave the static MyDbContext as is -->

public class MyDbContext: DbContext
{
    public static string ConnectionName = "Name = SMS_ADvTECHContext";
    static MyDbContext()
    {
        Database.SetInitializer<SMS_ADvTECHContext>(null);
    }

/*  public SMS_MyDbContext()
        : base(ConnectionName)
    {
    }*/
}

Then if you right click the context class --> Enityframework --> View Entity Data Model (read-only) it generate the view!

这篇关于EF Power Tools Beta 2 - 被调用的目标抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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