나는 추상 일반 클래스 BLL<T> where T : BusinessObject
있습니다. 구체적인 BLL 클래스 집합을 포함하는 어셈블리를 열고 사전 내에 튜플 (businessObjectType, concreteBLLType)을 반환해야합니다. 지금까지 할 수있는 방법 중 일부가 있지만 T를 발견하는 데 문제가 있습니다.일반 및 유형 유추
protected override Dictionary<Type, Type> DefineBLLs()
{
string bllsAssembly = ConfigurationManager.AppSettings["BLLsAssembly"];
Type[] types = LoadAssembly(bllsAssembly);
Dictionary<Type, Type> bllsTypes = new Dictionary<Type, Type>();
foreach (Type type in types)
{
if (type.IsSubclassOf(typeof(BLL<>)))
/* how to know T in the situation below? */
bllsTypes.Add(??businessObjectType (T)??, type);
}
return bllsTypes;
}
그럼, T는 여기까지 관련 않습니다
코드는 다음에이되었다? 코드가 나타내는 것은 분명하지 않습니다 (적어도 나에게). –
Jon이 코드를 정리했다고 생각합니다. –