internal EntitySetBaseMapping GetAssociationSetMapping(string setName)
        {
            EntitySetBaseMapping entitySetBaseMapping = (EntitySetBaseMapping)null;

            this.m_associationSetMappings.TryGetValue(setName, out entitySetBaseMapping);
            return(entitySetBaseMapping);
        }
Пример #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 EntitySetBaseMapping GetAssociationSetMapping(string setName)
        {
            DebugCheck.NotNull(setName);
            EntitySetBaseMapping setMapping = null;

            m_associationSetMappings.TryGetValue(setName, out setMapping);
            return(setMapping);
        }
Пример #3
0
 protected virtual void Visit(EntitySetBaseMapping setMapping)
 {
     foreach (var typeMapping in GetSequence(setMapping.TypeMappings, it => IdentityHelper.GetIdentity(it)))
     {
         Visit(typeMapping);
     }
     Visit(setMapping.EntityContainerMapping);
 }
Пример #4
0
 protected virtual void Visit(EntitySetBaseMapping setMapping)
 {
     foreach (TypeMapping typeMapping in this.GetSequence <TypeMapping>(setMapping.TypeMappings, (Func <TypeMapping, string>)(it => BaseMetadataMappingVisitor.IdentityHelper.GetIdentity(it))))
     {
         this.Visit(typeMapping);
     }
     this.Visit(setMapping.EntityContainerMapping);
 }
Пример #5
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 EntitySetBaseMapping GetEntitySetMapping(String setName)
        {
            DebugCheck.NotNull(setName);
            //Key for EntitySetMapping should be EntitySet name and Entoty type name
            EntitySetBaseMapping setMapping = null;

            m_entitySetMappings.TryGetValue(setName, out setMapping);
            return(setMapping);
        }
 internal ViewExpressionValidator(
     EntitySetBaseMapping setMapping,
     EntityTypeBase elementType,
     bool includeSubtypes)
 {
     this._setMapping      = setMapping;
     this._elementType     = elementType;
     this._includeSubtypes = includeSubtypes;
     this._errors          = new List <EdmSchemaError>();
 }
        internal bool HasQueryViewForSetMap(string setName)
        {
            EntitySetBaseMapping setMapping = this.GetSetMapping(setName);

            if (setMapping != null)
            {
                return(setMapping.QueryView != null);
            }
            return(false);
        }
Пример #8
0
            internal ViewExpressionValidator(EntitySetBaseMapping setMapping, EntityTypeBase elementType, bool includeSubtypes)
            {
                DebugCheck.NotNull(setMapping);
                DebugCheck.NotNull(elementType);

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

                _errors = new List <EdmSchemaError>();
            }
        protected override void Visit(EntitySetBaseMapping setMapping)
        {
            int instanceIndex;

            if (!this.AddObjectToSeenListAndHashBuilder((object)setMapping, out instanceIndex))
            {
                return;
            }
            this.AddObjectStartDumpToHashBuilder((object)setMapping, instanceIndex);
            base.Visit(setMapping);
            this.AddObjectEndDumpToHashBuilder();
        }
 internal static IEnumerable <EdmSchemaError> ValidateQueryView(
     DbQueryCommandTree view,
     EntitySetBaseMapping setMapping,
     EntityTypeBase elementType,
     bool includeSubtypes)
 {
     ViewValidator.ViewExpressionValidator expressionValidator = new ViewValidator.ViewExpressionValidator(setMapping, elementType, includeSubtypes);
     expressionValidator.VisitExpression(view.Query);
     if (expressionValidator.Errors.Count <EdmSchemaError>() != 0 || setMapping.Set.BuiltInTypeKind != BuiltInTypeKind.AssociationSet)
     {
         return(expressionValidator.Errors);
     }
     ViewValidator.AssociationSetViewValidator setViewValidator = new ViewValidator.AssociationSetViewValidator(setMapping);
     setViewValidator.VisitExpression(view.Query);
     return((IEnumerable <EdmSchemaError>)setViewValidator.Errors);
 }
        protected override void Visit(EntitySetBaseMapping setMapping)
        {
            int index;

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

            AddObjectStartDumpToHashBuilder(setMapping, index);

            #region Inner data visit

            base.Visit(setMapping);

            #endregion

            AddObjectEndDumpToHashBuilder();
        }
Пример #12
0
        // <summary>
        // Determines whether the given view is valid.
        // </summary>
        // <param name="view"> Query view to validate. </param>
        // <param name="setMapping"> Mapping in which view is declared. </param>
        // <returns> Errors in view definition. </returns>
        internal static IEnumerable <EdmSchemaError> ValidateQueryView(
            DbQueryCommandTree view, EntitySetBaseMapping 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);
        }
Пример #13
0
 public static string GetIdentity(EntitySetBaseMapping mapping)
 {
     return(mapping.Set.Identity);
 }
Пример #14
0
 internal AssociationSetViewValidator(EntitySetBaseMapping setMapping)
 {
     DebugCheck.NotNull(setMapping);
     _setMapping = setMapping;
 }
 internal AssociationSetViewValidator(EntitySetBaseMapping setMapping)
 {
     this._setMapping = setMapping;
 }
        protected override void Visit(EntitySetBaseMapping setMapping)
        {
            int index;
            if (!AddObjectToSeenListAndHashBuilder(setMapping, out index))
            {
                return;
            }

            AddObjectStartDumpToHashBuilder(setMapping, index);

            #region Inner data visit

            base.Visit(setMapping);

            #endregion

            AddObjectEndDumpToHashBuilder();
        }