今私は同様の問題に取り組んでいます。私は次にやった:
- 次のassemplitiesを作成する:
SF.Contracts - ServiceCotnractsとDataContractsを定義したばかりです。明らかにすべてのdatacontractsはEFのPOCOクラスのように使用できます(しかし、私はt4や他のジェネレータを使用しません - すべてのPOCOクラスとDataContextはマニュアルで書かれています。/7886285/ef4-navigationproperty-and-join-a-bug-or-a-feature ">悪いデータベース)を参照してください。
SF。
SF.DataAccessObjects - このassemlityで私は私のedmxとDataContextを実装しています。
SF.Services - WCFサービスの実装。
だから、多数のWCF選択メソッドが次の署名と実装を持っています:
public List VulnerSelect(int[] idList = null, string[] navigationPropertiesList = null)
{
var query = from vulner in _businessModel.DataModel.VulnerSet
select vulner;
if (navigationPropertiesList != null)
navigationPropertiesList.Select(p =>{query = ((ObjectQuery)query).Include(p);
return true; });
if (idList != null)
query = query.Where(p => idList.Contains(p.Id));
return query.ToList();
}
次のようにこのメソッドを使用することができます:
WCFproxy.VulnerSelect(new[]{1,2,3},new[]{"SecurityObjects", "SecurityObjrcts.Problem"});
あなたはserrialization、ナビゲーションプロパティなどに問題はなく、どのNavigationPropertiesをロードする必要があるかを明確に示すことができます。
p.s .:私の悪い英語のためのソーリー:)