您的位置:首页 > 其它

使用EF Power Tools 错误参数 80070057解决方法

2012-07-06 10:45 330 查看
错误参数。(异常来自 HRESULT:0x80070057 (E_INVALIDARG))

An error occurred while trying to instantiate the dbcontext type TestDB2Context see the output window for details

public class ProductContext : DbContext
{
public ProductContext()
: base(@"Data Source=.;Initial Catalog=Product;Integrated Security=True")
{ }
static ProductContext()
{
Database.SetInitializer<ProductContext>(null);
}

public DbSet<Category> Categories { get; set; }
public DbSet<Product> Products { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
modelBuilder.Configurations.Add(new CategoryMap());
modelBuilder.Configurations.Add(new ProductMap());
}

并且config文件中的仍然保留!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐