Beispiel #1
0
 /// <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 (!m_entitySetMappings.ContainsKey(setMapping.Set.Name))
     {
         m_entitySetMappings.Add(setMapping.Set.Name, setMapping);
     }
 }
Beispiel #2
0
        /// <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)
        {
            DebugCheck.NotNull(relationshipSetName);
            StorageSetMapping setMapping = null;

            m_associationSetMappings.TryGetValue(relationshipSetName, out setMapping);
            return(setMapping);
        }
 protected virtual void Visit(StorageSetMapping storageSetMapping)
 {
     foreach (var typeMapping in GetSequence(storageSetMapping.TypeMappings, it => IdentityHelper.GetIdentity(it)))
     {
         Visit(typeMapping);
     }
     Visit(storageSetMapping.EntityContainerMapping);
 }
 protected virtual void Visit(StorageSetMapping storageSetMapping)
 {
     foreach (var typeMapping in storageSetMapping.TypeMappings)
     {
         Visit(typeMapping);
     }
     Visit(storageSetMapping.EntityContainerMapping);
 }
 protected virtual void Visit(StorageSetMapping storageSetMapping)
 {
     foreach (var typeMapping in storageSetMapping.TypeMappings)
     {
         Visit(typeMapping);
     }
     Visit(storageSetMapping.EntityContainerMapping);
 }
Beispiel #6
0
        /// <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)
        {
            DebugCheck.NotNull(entitySetName);
            //Key for EntitySetMapping should be EntitySet name and Entoty type name
            StorageSetMapping setMapping = null;

            m_entitySetMappings.TryGetValue(entitySetName, out setMapping);
            return(setMapping);
        }
            internal ViewExpressionValidator(StorageSetMapping setMapping, EntityTypeBase elementType, bool includeSubtypes)
            {
                DebugCheck.NotNull(setMapping);
                DebugCheck.NotNull(elementType);

                _setMapping      = setMapping;
                _elementType     = elementType;
                _includeSubtypes = includeSubtypes;

                _errors = new List <EdmSchemaError>();
            }
Beispiel #8
0
        protected override void Visit(StorageSetMapping storageSetMapping)
        {
            int index;

            if (!AddObjectToSeenListAndHashBuilder(storageSetMapping, out index))
            {
                return;
            }

            AddObjectStartDumpToHashBuilder(storageSetMapping, index);

            #region Inner data visit

            base.Visit(storageSetMapping);

            #endregion

            AddObjectEndDumpToHashBuilder();
        }
        internal static IEnumerable <EdmSchemaError> ValidateQueryView(
            DbQueryCommandTree view, StorageSetMapping setMapping, EntityTypeBase elementType, bool includeSubtypes)
        {
            var 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 constructor might use an EntitySet that is different from
                //the EntitySet defined in the CSDL.
                if (setMapping.Set.BuiltInTypeKind
                    == BuiltInTypeKind.AssociationSet)
                {
                    var refValidator = new AssociationSetViewValidator(setMapping);
                    refValidator.VisitExpression(view.Query);
                    return(refValidator.Errors);
                }
            }
            return(validator.Errors);
        }
Beispiel #10
0
 /// <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)
 {
     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)
 {
     m_fragments = new List<StorageMappingFragment>();
     m_setMapping = setMapping;
 }
Beispiel #12
0
 /// <summary>
 ///     Construct the new StorageTypeMapping object.
 /// </summary>
 /// <param name="setMapping"> SetMapping that contains this type mapping </param>
 internal StorageTypeMapping(StorageSetMapping setMapping)
 {
     m_fragments  = new List <StorageMappingFragment>();
     m_setMapping = setMapping;
 }
 internal AssociationSetViewValidator(StorageSetMapping setMapping)
 {
     DebugCheck.NotNull(setMapping);
     _setMapping = setMapping;
 }
 public static string GetIdentity(StorageSetMapping mapping)
 {
     return(mapping.Set.Identity);
 }
 /// <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)
 {
     m_relation = relation;
 }
 /// <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 EntityTypeMapping object.
 /// </summary>
 /// <param name="setMapping"> Set Mapping that contains this Type mapping </param>
 public StorageEntityTypeMapping(StorageSetMapping setMapping)
     : base(setMapping)
 {
 }
        protected override void Visit(StorageSetMapping storageSetMapping)
        {
            int index;
            if (!AddObjectToSeenListAndHashBuilder(storageSetMapping, out index))
            {
                return;
            }

            AddObjectStartDumpToHashBuilder(storageSetMapping, index);

            #region Inner data visit

            base.Visit(storageSetMapping);

            #endregion

            AddObjectEndDumpToHashBuilder();
        }
 /// <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>
 public StorageAssociationTypeMapping(AssociationType relation, StorageSetMapping setMapping)
     : base(setMapping)
 {
     m_relation = relation;
 }
 /// <summary>
 ///     Construct the new EntityTypeMapping object.
 /// </summary>
 /// <param name="setMapping"> Set Mapping that contains this Type mapping </param>
 public StorageEntityTypeMapping(StorageSetMapping setMapping)
     : base(setMapping)
 {
 }