Exemplo n.º 1
0
        // internal for testing, virtual for mocking
        internal virtual void ValidateArtifactSet(EFArtifactSet artifactSet, bool forceValidation, bool validateMsl, bool runViewGen)
        {
            Debug.Assert(artifactSet != null, "artifactSet != null");
            Debug.Assert(!runViewGen || validateMsl, "ViewGen validation can only be performed if msl validation is requested");

            // First determine if we need to do validation
            if (!artifactSet.IsValidityDirtyForErrorClass(ErrorClass.Runtime_All) &&
                !forceValidation)
            {
                return;
            }

            // If we need to do validation, first clear out any existing errors on the artifact set.
            artifactSet.ClearErrors(ErrorClass.Runtime_All);

            var designArtifact = artifactSet.GetEntityDesignArtifact();

            if (designArtifact != null)
            {
                var storeItemCollection = ValidateStoreModel(designArtifact);
                var edmItemCollection   = ValidateConceptualModel(designArtifact);

                if (edmItemCollection != null &&
                    storeItemCollection != null &&
                    validateMsl)
                {
                    var mappingItemCollection = ValidateMapping(designArtifact, edmItemCollection, storeItemCollection);
                    if (mappingItemCollection != null && runViewGen)
                    {
                        ValidateWithViewGen(mappingItemCollection, designArtifact);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     // recompile the bindings at this point, but don't change the state of the item yet,
     // the derived classes do this because they have different rules
     Name.Rebind();
     ColumnName.Rebind();
 }
Exemplo n.º 3
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     if (EntitySet.RefName != null)
     {
         EntitySet.Rebind();
         ReturnTypeAsEntityType.Rebind();
         if (EntitySet.Status == BindingStatus.Known &&
             ReturnTypeAsEntityType.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
     }
     else if (IsReturnTypeComplexType)
     {
         ReturnTypeAsComplexType.Rebind();
         if (ReturnTypeAsComplexType.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
     }
     else
     {
         base.DoResolve(artifactSet);
     }
 }
        // internal for testing, virtual for mocking
        internal virtual void ValidateArtifactSet(EFArtifactSet artifactSet, bool forceValidation, bool validateMsl, bool runViewGen)
        {
            Debug.Assert(artifactSet != null, "artifactSet != null");
            Debug.Assert(!runViewGen || validateMsl, "ViewGen validation can only be performed if msl validation is requested");

            // First determine if we need to do validation
            if (!artifactSet.IsValidityDirtyForErrorClass(ErrorClass.Runtime_All)
                && !forceValidation)
            {
                return;
            }

            // If we need to do validation, first clear out any existing errors on the artifact set.
            artifactSet.ClearErrors(ErrorClass.Runtime_All);

            var designArtifact = artifactSet.GetEntityDesignArtifact();
            if (designArtifact != null)
            {
                var storeItemCollection = ValidateStoreModel(designArtifact);
                var edmItemCollection = ValidateConceptualModel(designArtifact);

                if (edmItemCollection != null
                    && storeItemCollection != null
                    && validateMsl)
                {
                    var mappingItemCollection = ValidateMapping(designArtifact, edmItemCollection, storeItemCollection);
                    if (mappingItemCollection != null && runViewGen)
                    {
                        ValidateWithViewGen(mappingItemCollection, designArtifact);
                    }
                }
            }
        }
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     Role.Rebind();
     if (Role.Status == BindingStatus.Known)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 6
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     Name.Rebind();
     if (Name.Status == BindingStatus.Known)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 7
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     TypeName.Rebind();
     // TypeName attribute is optional so its status might be undefined
     if (TypeName.Status == (int)BindingStatus.Known
         || TypeName.Status == (int)BindingStatus.Undefined)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 8
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     TypeName.Rebind();
     // TypeName attribute is optional so its status might be undefined
     if (TypeName.Status == (int)BindingStatus.Known ||
         TypeName.Status == (int)BindingStatus.Undefined)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 9
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            FunctionName.Rebind();
            FunctionImportName.Rebind();

            if (FunctionName.Status == BindingStatus.Known &&
                FunctionImportName.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 10
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            base.DoResolve(artifactSet);

            // a scalar property requires that both sides be Resolved
            if (Name.Status == BindingStatus.Known
                && ColumnName.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 11
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            base.DoResolve(artifactSet);

            // a scalar property requires that both sides be Resolved
            if (Name.Status == BindingStatus.Known &&
                ColumnName.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 12
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            Role.Rebind();
            EntitySet.Rebind();

            if (Role.Status == BindingStatus.Known &&
                EntitySet.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 13
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            CdmEntityContainer.Rebind();
            StorageEntityContainer.Rebind();

            // its not resolved unless we can resolve both sides
            if (CdmEntityContainer.Status == BindingStatus.Known &&
                StorageEntityContainer.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 14
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     Name.Rebind();
     TypeName.Rebind();
     StoreEntitySet.Rebind();
     if (Name.Status == BindingStatus.Known &&
         TypeName.Status == BindingStatus.Known &&
         StoreEntitySet.Status == BindingStatus.Known)
     {
         State = EFElementState.Resolved;
     }
 }
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            AssociationSet.Rebind();
            From.Rebind();
            To.Rebind();

            if (AssociationSet.Status == BindingStatus.Known &&
                From.Status == BindingStatus.Known &&
                To.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 16
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     if (_typeAttrForEnumType != null)
     {
         _typeAttrForEnumType.Rebind();
         if (_typeAttrForEnumType.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
         return;
     }
     base.DoResolve(artifactSet);
 }
Exemplo n.º 17
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            FunctionName.Rebind();
            RowsAffectedParameter.Rebind();

            // RowsAffectedParameter is optional so its Status might be Undefined
            if (BindingStatus.Known == FunctionName.Status &&
                (BindingStatus.Known == RowsAffectedParameter.Status ||
                 BindingStatus.Undefined == RowsAffectedParameter.Status))
            {
                State = EFElementState.Resolved;
            }
        }
        /// <summary>
        ///     Schedule unknown or undefined bindings in the given artifact set for rebinding when the transaction completes
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="artifactSet"></param>
        internal static void ScheduleUnknownBindingsForRebind(CommandProcessorContext cpc, EFArtifactSet artifactSet)
        {
            Debug.Assert(cpc != null);
            Debug.Assert(artifactSet != null);

            var ubv = new UnknownBindingVisitor();
            foreach (var artifact in artifactSet.Artifacts)
            {
                ubv.Traverse(artifact);
            }

            ScheduleBindingsForRebind(cpc, ubv.UnknownBindings);
        }
Exemplo n.º 19
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     // first, try to resolve the base type if there is one
     if (BaseType.RefName == null)
     {
         // rebind so we can re-set any pre-bound things
         BaseType.Rebind();
         base.DoResolve(artifactSet);
     }
     else
     {
         BaseType.Rebind();
         if (BaseType.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
     }
 }
Exemplo n.º 20
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            base.DoResolve(artifactSet);

            // a given condition can only have mapping to a property (E-Space) or a column (S-Space)
            // but not to both
            if (Name.Status == BindingStatus.Known &&
                ColumnName.Status == BindingStatus.Known)
            {
                var errorInfo = new ErrorInfo(
                    ErrorInfo.Severity.ERROR, Resources.RESOLVE_CONDITION_BOUND_TO_PROP_AND_COLUMN, this,
                    ErrorCodes.RESOLVE_CONDITION_BOUND_TO_PROP_AND_COLUMN, ErrorClass.ResolveError);
                artifactSet.AddError(errorInfo);
            }
            else if (Name.Status == BindingStatus.Known ||
                     ColumnName.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 21
0
        internal static void ValidateEscherModel(EFArtifactSet set, bool forceValidation)
        {
            // TODO: Check if the validity is dirty for certain Escher error classes and validate
            // only against those. For now there is no immediate need for this.
            if (!set.IsValidityDirtyForErrorClass(ErrorClass.Escher_All) &&
                !forceValidation)
            {
                return;
            }

            ClearErrors(set);
            var artifact = set.GetEntityDesignArtifact();

            if (artifact != null)
            {
                var visitor = new EscherModelValidatorVisitor(set);
                visitor.Traverse(artifact);
                artifact.SetValidityDirtyForErrorClass(ErrorClass.Escher_All, false);
            }
        }
        private static Symbol GetSymbolBasedOnModificationFunction(
            EFArtifactSet artifactSet, ModificationFunction mod, string refName)
        {
            Debug.Assert(mod != null, "GetSymbolBasedOnModificationFunction passed a null ModificationFunction");

            Symbol symbol = null;
            if (mod.FunctionName.Status == BindingStatus.Known)
            {
                symbol = new Symbol(mod.FunctionName.Target.NormalizedName, refName);

                Debug.Assert(artifactSet != null, "GetSymbolBasedOnModificationFunction passed a null EFArtifactSet");
                if (null != artifactSet)
                {
                    var item = artifactSet.LookupSymbol(symbol);
                    if (item == null)
                    {
                        symbol = null;
                    }
                }
            }

            return symbol;
        }
Exemplo n.º 23
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            if (Relationship.RefName != null)
            {
                Relationship.Rebind();
            }

            if (ToRole.RefName != null)
            {
                ToRole.Rebind();
            }

            if (FromRole.RefName != null)
            {
                FromRole.Rebind();
            }

            if (FromRole.Status == BindingStatus.Known &&
                ToRole.Status == BindingStatus.Known &&
                Relationship.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
        private static Symbol GetSymbolBasedOnModificationFunction(
            EFArtifactSet artifactSet, ModificationFunction mod, string refName)
        {
            Debug.Assert(mod != null, "GetSymbolBasedOnModificationFunction passed a null ModificationFunction");

            Symbol symbol = null;

            if (mod.FunctionName.Status == BindingStatus.Known)
            {
                symbol = new Symbol(mod.FunctionName.Target.NormalizedName, refName);

                Debug.Assert(artifactSet != null, "GetSymbolBasedOnModificationFunction passed a null EFArtifactSet");
                if (null != artifactSet)
                {
                    var item = artifactSet.LookupSymbol(symbol);
                    if (item == null)
                    {
                        symbol = null;
                    }
                }
            }

            return(symbol);
        }
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            AssociationSet.Rebind();
            From.Rebind();
            To.Rebind();

            if (AssociationSet.Status == BindingStatus.Known
                && From.Status == BindingStatus.Known
                && To.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        ///     Schedule unknown or undefined bindings in the given artifact set for rebinding when the transaction completes
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="artifactSet"></param>
        internal static void ScheduleUnknownBindingsForRebind(CommandProcessorContext cpc, EFArtifactSet artifactSet)
        {
            Debug.Assert(cpc != null);
            Debug.Assert(artifactSet != null);

            var ubv = new UnknownBindingVisitor();

            foreach (var artifact in artifactSet.Artifacts)
            {
                ubv.Traverse(artifact);
            }

            ScheduleBindingsForRebind(cpc, ubv.UnknownBindings);
        }
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     Name.Rebind();
     TypeName.Rebind();
     StoreEntitySet.Rebind();
     if (Name.Status == BindingStatus.Known
         && TypeName.Status == BindingStatus.Known
         && StoreEntitySet.Status == BindingStatus.Known)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 28
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     if (Name.RefName != null)
     {
         Name.Rebind();
         if (Name.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
     }
 }
Exemplo n.º 29
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     // recompile the bindings at this point, but don't change the state of the item yet,
     // the derived classes do this because they have different rules
     Name.Rebind();
     ColumnName.Rebind();
 }
Exemplo n.º 30
0
 internal EscherModelValidatorVisitor(EFArtifactSet artifactSet)
 {
     _artifactSet = artifactSet;
 }
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            FunctionName.Rebind();
            RowsAffectedParameter.Rebind();

            // RowsAffectedParameter is optional so its Status might be Undefined
            if (BindingStatus.Known == FunctionName.Status
                && (BindingStatus.Known == RowsAffectedParameter.Status ||
                    BindingStatus.Undefined == RowsAffectedParameter.Status))
            {
                State = EFElementState.Resolved;
            }
        }
Exemplo n.º 32
0
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            if (Relationship.RefName != null)
            {
                Relationship.Rebind();
            }

            if (ToRole.RefName != null)
            {
                ToRole.Rebind();
            }

            if (FromRole.RefName != null)
            {
                FromRole.Rebind();
            }

            if (FromRole.Status == BindingStatus.Known
                && ToRole.Status == BindingStatus.Known
                && Relationship.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
 public void ValidateAndCompileMappings(EFArtifactSet artifactSet, bool validateMapping)
 {
     // validate each artifact set
     ValidateArtifactSet(artifactSet, /*forceValidation*/ false, /*validateMsl*/ validateMapping, /*runViewGen*/ validateMapping);
 }
 public void Validate(EFArtifactSet artifactSet)
 {
     ValidateArtifactSet(artifactSet, /*forceValidation*/ true, /*validateMsl*/ true, /*runViewGen*/ false);
 }
Exemplo n.º 35
0
 internal static void ClearErrors(EFArtifactSet artifactSet)
 {
     artifactSet.ClearErrors(ErrorClass.Escher_All);
 }
Exemplo n.º 36
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     TypeName.Rebind();
     if (TypeName.Status == (int)BindingStatus.Known)
     {
         State = EFElementState.Resolved;
     }
 }
Exemplo n.º 37
0
 protected override void DoResolve(EFArtifactSet artifactSet)
 {
     if (_typeAttrForEnumType != null)
     {
         _typeAttrForEnumType.Rebind();
         if (_typeAttrForEnumType.Status == BindingStatus.Known)
         {
             State = EFElementState.Resolved;
         }
         return;
     }
     base.DoResolve(artifactSet);
 }
Exemplo n.º 38
0
 public void Validate(EFArtifactSet artifactSet)
 {
     ValidateArtifactSet(artifactSet, /*forceValidation*/ true, /*validateMsl*/ true, /*runViewGen*/ false);
 }
Exemplo n.º 39
0
 internal ResolvingVisitor(EFArtifactSet artifactSet)
 {
     _artifactSet = artifactSet;
 }
Exemplo n.º 40
0
 public void ValidateAndCompileMappings(EFArtifactSet artifactSet, bool validateMapping)
 {
     // validate each artifact set
     ValidateArtifactSet(artifactSet, /*forceValidation*/ false, /*validateMsl*/ validateMapping, /*runViewGen*/ validateMapping);
 }
Exemplo n.º 41
0
        private static NormalizedName GetNormalizedNameRelativeToEntityType(EntityType et, string refName, EFArtifactSet artifactSet)
        {
            var symbol = new Symbol(et.NormalizedName, refName);
            var item   = artifactSet.LookupSymbol(symbol);

            if (item != null)
            {
                return(new NormalizedName(symbol, null, null, refName));
            }
            return(null);
        }
        protected override void DoResolve(EFArtifactSet artifactSet)
        {
            FunctionName.Rebind();
            FunctionImportName.Rebind();

            if (FunctionName.Status == BindingStatus.Known
                && FunctionImportName.Status == BindingStatus.Known)
            {
                State = EFElementState.Resolved;
            }
        }
 private static NormalizedName GetNormalizedNameRelativeToEntityType(EntityType et, string refName, EFArtifactSet artifactSet)
 {
     var symbol = new Symbol(et.NormalizedName, refName);
     var item = artifactSet.LookupSymbol(symbol);
     if (item != null)
     {
         return new NormalizedName(symbol, null, null, refName);
     }
     return null;
 }
Exemplo n.º 44
0
 internal ResolvingVisitor(EFArtifactSet artifactSet)
 {
     _artifactSet = artifactSet;
 }