小编Chr*_*ent的帖子

实体框架4.1Code首先连接到Sql Server 2005

我正在尝试将Entity Framework 4.1 RC与SQL Server 2005实例一起使用.我创建了一个空数据库,我想将我的POCO对象保存到它.我的POCO看起来像:

public class Cart
{
    public Cart()
    {
        this.CartId = Guid.NewGuid();

    }

    public Guid CartId { get; set; }
    public decimal TotalCost { get; set; }
    public decimal SubTotalCost { get; set; }
    public decimal Tax { get; set; }
    public decimal EstimatedShippingCost { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的CartContext是:

public class CartContext : DbContext
{
    public DbSet<Cart> Carts { get; set; }
    public DbSet<Attribute> Attributes { get; set; }
    public DbSet<AttributeItem> AttributeItems { get; set; …
Run Code Online (Sandbox Code Playgroud)

entity-framework ef-code-first entity-framework-4.1

6
推荐指数
1
解决办法
6215
查看次数