/// <summary> /// Adds an entity set mapping to the list of EntitySetMaps /// under this entity container mapping. The method will be called /// by the Mapping loader. /// </summary> internal void AddEntitySetMapping(StorageSetMapping setMapping) { if (!this.m_entitySetMappings.ContainsKey(setMapping.Set.Name)) { this.m_entitySetMappings.Add(setMapping.Set.Name, setMapping); } }
protected virtual void Visit(StorageSetMapping storageSetMapping) { foreach (var typeMapping in storageSetMapping.TypeMappings) { Visit(typeMapping); } Visit(storageSetMapping.EntityContainerMapping); }
/// <summary> /// Get a RelationShip set mapping based upon the name of the relationship set /// </summary> /// <param name="relationshipSetName">the name of the relationship set</param> /// <returns>the mapping for the entity set if it exists, null if it does not exist</returns> internal StorageSetMapping GetRelationshipSetMapping(string relationshipSetName) { EntityUtil.CheckArgumentNull(relationshipSetName, "relationshipSetName"); StorageSetMapping setMapping = null; m_associationSetMappings.TryGetValue(relationshipSetName, out setMapping); return(setMapping); }
/// <summary> /// get an EntitySet mapping based upon the name of the entity set. /// </summary> /// /// <param name="entitySetName">the name of the entity set</param> internal StorageSetMapping GetEntitySetMapping(String entitySetName) { EntityUtil.CheckArgumentNull(entitySetName, "entitySetName"); //Key for EntitySetMapping should be EntitySet name and Entoty type name StorageSetMapping setMapping = null; m_entitySetMappings.TryGetValue(entitySetName, out setMapping); return(setMapping); }
/// <summary> /// Get a set mapping based upon the name of the set /// </summary> /// <param name="setName"></param> /// <returns></returns> internal StorageSetMapping GetSetMapping(string setName) { StorageSetMapping setMap = GetEntitySetMapping(setName); if (setMap == null) { setMap = GetRelationshipSetMapping(setName); } return(setMap); }
/// <summary> /// Returns whether the Set Map for the given set has a query view or not /// </summary> /// <param name="setName"></param> /// <returns></returns> internal bool HasQueryViewForSetMap(string setName) { StorageSetMapping set = GetSetMapping(setName); if (set != null) { return(set.QueryView != null); } return(false); }
internal ViewExpressionValidator(StorageSetMapping setMapping, EntityTypeBase elementType, bool includeSubtypes) { Debug.Assert(null != setMapping); Debug.Assert(null != elementType); _setMapping = setMapping; _elementType = elementType; _includeSubtypes = includeSubtypes; _errors = new List <EdmSchemaError>(); }
protected override void Visit(StorageSetMapping storageSetMapping) { int index; if (!this.AddObjectToSeenListAndHashBuilder(storageSetMapping, out index)) { return; } this.AddObjectStartDumpToHashBuilder(storageSetMapping, index); #region Inner data visit base.Visit(storageSetMapping); #endregion this.AddObjectEndDumpToHashBuilder(); }
/// <summary> /// Determines whether the given view is valid. /// </summary> /// <param name="view">Query view to validate.</param> /// <param name="storeItemCollection">Store item collection.</param> /// <param name="setMapping">Mapping in which view is declared.</param> /// <returns>Errors in view definition.</returns> internal static IEnumerable <EdmSchemaError> ValidateQueryView(DbQueryCommandTree view, StorageSetMapping setMapping, EntityTypeBase elementType, bool includeSubtypes) { ViewExpressionValidator validator = new ViewExpressionValidator(setMapping, elementType, includeSubtypes); validator.VisitExpression(view.Query); if (validator.Errors.Count() == 0) { //For AssociationSet views, we have to check for a specific pattern of errors where //the Ref expression passed into the construcor might use an EntitySet that is different from //the EntitySet defined in the CSDL. if (setMapping.Set.BuiltInTypeKind == BuiltInTypeKind.AssociationSet) { AssociationSetViewValidator refValidator = new AssociationSetViewValidator(setMapping); refValidator.VisitExpression(view.Query); return(refValidator.Errors); } } return(validator.Errors); }
/// <summary> /// Construct the new AssociationTypeMapping object. /// </summary> /// <param name="relation">Represents the Association Type metadata object</param> /// <param name="setMapping">Set Mapping that contains this Type mapping </param> internal StorageAssociationTypeMapping(AssociationType relation, StorageSetMapping setMapping) : base(setMapping) { this.m_relation = relation; }
internal AssociationSetViewValidator(StorageSetMapping setMapping) : base() { Debug.Assert(setMapping != null); _setMapping = setMapping; }
/// <summary> /// Construct the new EntityTypeMapping object. /// </summary> /// <param name="setMapping">Set Mapping that contains this Type mapping </param> internal StorageEntityTypeMapping(StorageSetMapping setMapping) : base(setMapping) { }
/// <summary> /// Construct the new StorageTypeMapping object. /// </summary> /// <param name="setMapping">SetMapping that contains this type mapping </param> internal StorageTypeMapping(StorageSetMapping setMapping) { this.m_fragments = new List<StorageMappingFragment>(); this.m_setMapping = setMapping; }
/// <summary> /// Adds a association set mapping to the list of AssociationSetMaps /// under this entity container mapping. The method will be called /// by the Mapping loader. /// </summary> internal void AddAssociationSetMapping(StorageSetMapping setMapping) { this.m_associationSetMappings.Add(setMapping.Set.Name, setMapping); }
/// <summary> /// Construct the new StorageTypeMapping object. /// </summary> /// <param name="setMapping">SetMapping that contains this type mapping </param> internal StorageTypeMapping(StorageSetMapping setMapping) { this.m_fragments = new List <StorageMappingFragment>(); this.m_setMapping = setMapping; }