public override IReadOnlyList <PropertyInfo> GetManyToManyProperties(Type clrType) { List <PropertyInfo>?properties = null; TableFullName tableFullName = _typeDefinitionManager.GetDynamicTypeDefinition(clrType).TableFullName; foreach ((String navigationName, TableFullName manyToManyTarget) in _dynamicMetadataProvider.GetManyToManyProperties(tableFullName)) { if (properties == null) { properties = new List <PropertyInfo>(); } Type itemType = _typeDefinitionManager.GetDynamicTypeDefinition(manyToManyTarget).DynamicTypeType; Type propertyType = typeof(IEnumerable <>).MakeGenericType(itemType); properties.Add(new OeShadowPropertyInfo(clrType, propertyType, navigationName)); } return(properties ?? (IReadOnlyList <PropertyInfo>)Array.Empty <PropertyInfo>()); }
protected override OeShadowPropertyInfo CreateShadowProperty(IPropertyBase efProperty) { if (efProperty is INavigation efNavigation) { Type propertyType = efNavigation.IsDependentToPrincipal() ? efNavigation.ForeignKey.PrincipalEntityType.ClrType : efNavigation.ForeignKey.DeclaringEntityType.ClrType; if (efNavigation.IsCollection()) { propertyType = typeof(ICollection <>).MakeGenericType(new Type[] { propertyType }); } return(new OeShadowPropertyInfo(efNavigation.DeclaringType.ClrType, propertyType, efNavigation.Name)); } DynamicTypeDefinition typeDefinition = _typeDefinitionManager.GetDynamicTypeDefinition(efProperty.DeclaringType.ClrType); MethodInfo getMethodInfo = typeDefinition.AddShadowPropertyGetMethodInfo(efProperty.Name, efProperty.ClrType); return(new OeShadowPropertyInfo(efProperty.DeclaringType.ClrType, efProperty.ClrType, efProperty.Name, getMethodInfo)); }