private static (PropertyInfo Many, PropertyInfo Join) GetManyToManyInfo(OeEdmModelMetadataProvider metadataProvider, Type entityType) { var collectionProperties = new List <PropertyInfo>(); foreach (PropertyInfo propertyInfo in entityType.GetProperties()) { if (!Parsers.OeExpressionHelper.IsPrimitiveType(propertyInfo.PropertyType) && Parsers.OeExpressionHelper.GetCollectionItemType(propertyInfo.PropertyType) != null) { collectionProperties.Add(propertyInfo); } } foreach (PropertyInfo propertyInfo in collectionProperties) { if (metadataProvider.IsNotMapped(propertyInfo)) { Type itemType = Parsers.OeExpressionHelper.GetCollectionItemType(propertyInfo.PropertyType); foreach (PropertyInfo propertyInfo2 in collectionProperties) { if (!metadataProvider.IsNotMapped(propertyInfo2)) { Type itemType2 = Parsers.OeExpressionHelper.GetCollectionItemType(propertyInfo2.PropertyType); PropertyInfo partnerProperty = GetPartnerProperty(itemType, itemType2); if (partnerProperty != null && itemType == partnerProperty.PropertyType) { return(propertyInfo, partnerProperty); } } } } } return(default);
public void BuildStructuralProperties(EdmModel edmModel, Dictionary <Type, EntityTypeInfo> entityTypes, Dictionary <Type, EdmEnumType> enumTypes, Dictionary <Type, EdmComplexType> complexTypes) { foreach (PropertyInfo clrProperty in _metadataProvider.GetProperties(ClrType)) { if (!_metadataProvider.IsNotMapped(clrProperty)) { EdmStructuralProperty?edmProperty = BuildStructuralProperty(entityTypes, enumTypes, complexTypes, clrProperty); if (edmProperty != null && _metadataProvider.IsDatabaseGenerated(clrProperty)) { var databaseGenerated = new EdmVocabularyAnnotation(edmProperty, CoreVocabularyModel.ComputedTerm, new EdmBooleanConstant(true)); edmModel.SetVocabularyAnnotation(databaseGenerated); } } } if (_isDbQuery) { AddDbQueryKeys(); } else { AddKeys(); } }
public void BuildProperties(Dictionary <Type, EntityTypeInfo> entityTypes, Dictionary <Type, EdmEnumType> enumTypes, Dictionary <Type, EdmComplexType> complexTypes) { foreach (PropertyInfo clrProperty in _metadataProvider.GetProperties(ClrType)) { if (!_metadataProvider.IsNotMapped(clrProperty)) { BuildProperty(entityTypes, enumTypes, complexTypes, clrProperty); } } AddKeys(); }
public void BuildProperties(Dictionary <Type, EntityTypeInfo> entityTypes, Dictionary <Type, EdmEnumType> enumTypes, Dictionary <Type, EdmComplexType> complexTypes) { foreach (PropertyInfo clrProperty in _clrType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) { if (!_metadataProvider.IsNotMapped(clrProperty)) { BuildProperty(entityTypes, enumTypes, complexTypes, clrProperty); } } AddKeys(); }