0

ドメイン クラスに仮想 ICollection プロパティがあります。そのプロパティをそのままにしておくと、クエリの後にそよ風によって生成されるアイテムには、entityaspect 属性がありません。仮想を削除すると、すべてが機能します。

例:

これは A Products Poco です:

public class Product : BaseEntity  
{


    [Required]
    public string Name { get; set; }       

    public decimal Price { get; set; }

    public string Description { get; set; }

      //  if i leave the property like this, everything works fine.

    public  ICollection<Category> Categories { get; set; }

     //if i do something like this, the entities are loaded by breeze, 
       but they  got  no  entity aspect property 

    public virtual  ICollection<Category> Categories { get; set; }



}
4

1 に答える 1

0

でプロキシの作成を無効にし、遅延読み込みを無効にしたことを確認してくださいDbContext。次のようなことを行うことができます。

   this.Configuration.LazyLoadingEnabled = false;
   this.Configuration.ProxyCreationEnabled = false;

または、次のようEFContextProviderにアクセスするために使用できます。DbContext

 var contextProvider = new EFContextProvider<MyDbContext>();

 contextProvider.Context //this is the DbContext
于 2014-02-25T00:25:35.133 に答える