속성을 DbSet으로 캐스팅하고 load 메서드를 호출하는 메서드를 작성하려고합니다.캐스트 DbSet <T> 및 호출 메서드
나는 시도 다음
var value = propertyInfo.GetValue(em, null) as DbSet;
//Not working, because it always returns null
var value = propertyInfo.GetValue(em, null) as DbSet<T>;
//Not working, because its a syntax error and doesnt even compile (giving error 'Cannot resolve symbol T')
var value = propertyInfo.GetValue(em, null) as DbSet<TEntity>;
//Not working, because its a syntax error and doesnt even compile (giving error 'Cannot resolve symbol TEntity')
하지만 올바른 유형에게 그 작업을 지정하는 경우에만 :
var value = propertyInfo.GetValue(em, null) as DbSet<TempTable>;
가 어떻게 밖으로 TEMPTABLE를 지정하여이 문제를 해결할 수 있습니까? 아마도 이런
은
"그러나 올바른 유형의 작업을 지정할 때만 : "- 잘 작동하지 않을 때 어떤 일이 발생하는지 정확하게 말할 수 있습니까? 오류/예외/등은 무엇입니까? 또한 : 여기에'T'와'TEntity'는 무엇입니까? 그것은'TempTable'과 동일하지만 generic 형식 매개 변수입니까? –
@MarcGravell : 내 편집 좀 봐, 난 그냥 T 또는 TEntity 희망이있다, 그 일을하는 방법 thats 또한