POCO を使用して、エンティティを DAL プロジェクトからエンティティ プロジェクトに自動生成しています。現在、ビュー クラスを手動で作成する必要はありません。
ただし、1 つの問題があります。ナビゲーション プロパティを持つ poco オブジェクトを返そうとすると[WebMethod]
、次のエラーが発生します。
Cannot serialize member Entities.City.Customers of type System.Collections.Generic.ICollection1[[Entities.Customer, Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] because it is an interface.
書い context.ContextOptions.LazyLoadingEnabled = false;
て
みcontext.ContextOptions.ProxyCreationEnabled = false;
ましたがダメでした。
プロパティの前に追加 [System.Xml.Serialization.XmlIgnore]
すると、エラーは発生しませんが、それらのプロパティが失われますか?