2012-01-07 7 views
0

私はEntity Frameworkを使用しますが、エンティティにある種の依存関係があるかどうかを知る必要がありますが、この変更はアイテムにステータスを変更する必要があります関連する項目に依存する。例:エンティティに関連する依存関係をチェックする一般的な方法

public class DependencyServices<TEntity> where TEntity: Entity 
    { 
     public bool VerifyDependencies(TEntity entity) 
     { 
      if(entity.Dependency != null) 
      { 
       return true; 
      } 

      return false; 
     } 

    } 
+2

あなたが求めていることは絶対に明確ではありません。 –

答えて

0

このコードは、依存関係がEntityクラスで定義されている場合にのみ機能します。その場合、汎用関数は必要ありません。

public bool HasDependencies 
{ 
    get 
    { 
     return Dependency !=null; 
    } 
} 
関連する問題