public EntityTypeConfiguration <TEntity> Filter(QueryOptionSetting setting, params String[] propertyNames) { foreach (String propertyName in propertyNames) { IEdmProperty edmProperty = _entityType.GetPropertyIgnoreCase(propertyName); _modelBuilder.ModelBoundSettingsBuilder.SetFilter(edmProperty, setting == QueryOptionSetting.Allowed); } return(this); }
public PropertyConfiguration <TEntity> Select(SelectExpandType expandType, params String[] propertyNames) { var navigationProperty = (IEdmNavigationProperty)_edmProperty; IEdmEntityType entityType = navigationProperty.ToEntityType(); foreach (String propertyName in propertyNames) { IEdmProperty edmProperty = entityType.GetPropertyIgnoreCase(propertyName); _modelBuilder.ModelBoundSettingsBuilder.SetSelect(edmProperty, expandType, navigationProperty); } return(this); }
public PropertyConfiguration <TEntity> OrderBy(QueryOptionSetting setting, params String[] propertyNames) { var navigationProperty = (IEdmNavigationProperty)_edmProperty; IEdmEntityType entityType = navigationProperty.ToEntityType(); foreach (String propertyName in propertyNames) { IEdmProperty edmProperty = entityType.GetPropertyIgnoreCase(propertyName); _modelBuilder.ModelBoundSettingsBuilder.SetOrderBy(edmProperty, setting == QueryOptionSetting.Allowed, navigationProperty); } return(this); }
public override DynamicDependentPropertyInfo GetDependentProperties(String tableName, String navigationPropertyName) { IEdmEntityType edmEntityType = OeEdmClrHelper.GetEntitySet(_edmModel, tableName).EntityType(); var navigationProperty = (IEdmNavigationProperty)edmEntityType.GetPropertyIgnoreCase(navigationPropertyName); bool isCollection = navigationProperty.Type.IsCollection(); String principalEntityName; String dependentEntityName; if (isCollection) { principalEntityName = edmEntityType.Name; dependentEntityName = navigationProperty.ToEntityType().Name; } else { principalEntityName = navigationProperty.ToEntityType().Name; dependentEntityName = edmEntityType.Name; } IEnumerable <IEdmStructuralProperty> principalProperties; IEnumerable <IEdmStructuralProperty> dependentProperties; if (navigationProperty.IsPrincipal()) { principalProperties = navigationProperty.Partner.PrincipalProperties(); dependentProperties = navigationProperty.Partner.DependentProperties(); } else { principalProperties = navigationProperty.PrincipalProperties(); dependentProperties = navigationProperty.DependentProperties(); } var dependentPropertyNames = new List <String>(); foreach (IEdmStructuralProperty structuralProperty in dependentProperties) { dependentPropertyNames.Add(structuralProperty.Name); } var principalPropertyNames = new List <String>(); foreach (IEdmStructuralProperty structuralProperty in principalProperties) { principalPropertyNames.Add(structuralProperty.Name); } return(new DynamicDependentPropertyInfo(principalEntityName, dependentEntityName, principalPropertyNames, dependentPropertyNames, isCollection)); }
private void BuildAttributes(IEdmEntityType edmEntityType, Type clrEntityType) { IEnumerable <T> attributes = clrEntityType.GetCustomAttributes <T>(); foreach (T attribute in attributes) { if (GetConfigurations(attribute).Count == 0) { foreach (IEdmProperty edmProperty in edmEntityType.Properties()) { SetProperty(edmProperty, IsAllowed(attribute)); } } else { foreach (KeyValuePair <String, SelectExpandType> configuration in GetConfigurations(attribute)) { IEdmProperty edmProperty = edmEntityType.GetPropertyIgnoreCase(configuration.Key); SetProperty(edmProperty, configuration.Value); } } } foreach (IEdmProperty edmProperty in edmEntityType.Properties()) { PropertyInfo clrProperty = clrEntityType.GetPropertyIgnoreCase(edmProperty); if (edmProperty is IEdmNavigationProperty navigationProperty) { attributes = clrProperty.GetCustomAttributes <T>(); IEdmEntityType navigationEntityType = navigationProperty.ToEntityType(); foreach (T attribute in attributes) { SetProperty(navigationProperty, IsAllowed(attribute)); foreach (KeyValuePair <String, SelectExpandType> configuration in GetConfigurations(attribute)) { IEdmProperty edmProperty2 = navigationEntityType.GetPropertyIgnoreCase(configuration.Key); SetProperty(edmProperty2, configuration.Value, navigationProperty); } } } else { var attribute = (T)clrProperty.GetCustomAttribute(typeof(T)); if (attribute != null) { SetProperty(edmProperty, IsAllowed(attribute)); } } } }