는 Type.ContainsGenericParameters 내가 동적으로 인스턴스를 생성 반사를 사용하고
사실 때문에의 인스턴스를 만들 수 없습니다.
var typesTR = Assembly.GetAssembly(typeof(BGenericConfigurationClass<>)).GetTypes()
.Where(type =>
!string.IsNullOrEmpty(type.Namespace) &&
(type.Namespace == "EntitiesConfiguration"))
.Where(type => type.BaseType != null
&& type.BaseType.IsGenericType
&&
(type.BaseType.GetGenericTypeDefinition() == typeof(BGenericConfigurationClass<>) ||
type.BaseType.GetGenericTypeDefinition() == typeof(CGenericConfigurationClass<>)));
foreach (var type in typesTR)
{
dynamic configurationInstance = Activator.CreateInstance(type);
modelBuilder.Configurations.Add(configurationInstance);
}
내 예외는 다음입니다 : - 는 "Type.ContainsGenericParameters 사실 때문에 CGenericConfigurationClass`1 [T]의 인스턴스를 만들 수 없습니다."
이미지가 전혀 도움이되지 않습니다. 그것을 제거하고 대신 코드를 보여주십시오. 또한 EF에는 어셈블리에서 'EntityTypeConfiguration'클래스를 검색 할 수있는 내장 함수가 있습니다. –
정확한 코드를 얻기 위해 실시간 이메일을 제공하십시오. –
ef의 EntityTypeConfiguration 클래스를 사용하여 다중 레벨 상속을 사용하려고합니다. 어떤 아이디어 나 해결책을 알려주십시오. –