小编Haa*_*onL的帖子

EF,Code First,WCF =>空集合问题

我在使用Ef 4.1代码时遇到了一些问题.

public class Foo()
{
    public Foo()
    {
        Id = Guid.NewGuid();
        Bars = new Collection<Bar>();
    }

    public Guid Id { get; set; }
    public string Name { get; set; }
    public virtual ICollection Bars { get; set; }
}

public class Bar()
{
    public Bar()
    {
        Id = Guid.NewGuid();
    }

    public Guid Id { get; set; }
    public string Name { get; set; }
    public virtual Foo Foo { get; set;}
}

public class MyContext : DbContext
{
    public …
Run Code Online (Sandbox Code Playgroud)

c# wcf ef-code-first entity-framework-4.1

3
推荐指数
1
解决办法
1994
查看次数

标签 统计

c# ×1

ef-code-first ×1

entity-framework-4.1 ×1

wcf ×1