예제 #1
0
        protected void AddFunctionType(Function function)
        {
            var space = DataModel == SchemaDataModelOption.EntityDataModel ? "Conceptual" : "Storage";

            if (SchemaVersion >= XmlConstants.EdmVersionForV2 &&
                SchemaManager.SchemaTypes.ContainsKey(function.FQName))
            {
                function.AddError(
                    ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error,
                    Strings.AmbiguousFunctionAndType(function.FQName, space));
            }
            else
            {
                var error = SchemaManager.SchemaTypes.TryAdd(function);
                Debug.Assert(error != AddErrorKind.MissingNameError, "Function identity can never be null while adding global functions");

                if (error != AddErrorKind.Succeeded)
                {
                    function.AddError(
                        ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error,
                        Strings.AmbiguousFunctionOverload(function.FQName, space));
                }
                else
                {
                    SchemaTypes.Add(function);
                }
            }
        }
예제 #2
0
        protected void AddFunctionType(Function function)
        {
            string str = this.DataModel == SchemaDataModelOption.EntityDataModel ? "Conceptual" : "Storage";

            if (this.SchemaVersion >= 2.0 && this.SchemaManager.SchemaTypes.ContainsKey(function.FQName))
            {
                function.AddError(ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error, (object)Strings.AmbiguousFunctionAndType((object)function.FQName, (object)str));
            }
            else if (this.SchemaManager.SchemaTypes.TryAdd((SchemaType)function) != AddErrorKind.Succeeded)
            {
                function.AddError(ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error, (object)Strings.AmbiguousFunctionOverload((object)function.FQName, (object)str));
            }
            else
            {
                this.SchemaTypes.Add((SchemaType)function);
            }
        }
예제 #3
0
        protected void AddFunctionType(Function function)
        {
            var space = DataModel == SchemaDataModelOption.EntityDataModel ? "Conceptual" : "Storage";

            if (SchemaVersion >= XmlConstants.EdmVersionForV2
                && SchemaManager.SchemaTypes.ContainsKey(function.FQName))
            {
                function.AddError(
                    ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error,
                    Strings.AmbiguousFunctionAndType(function.FQName, space));
            }
            else
            {
                var error = SchemaManager.SchemaTypes.TryAdd(function);
                Debug.Assert(error != AddErrorKind.MissingNameError, "Function identity can never be null while adding global functions");

                if (error != AddErrorKind.Succeeded)
                {
                    function.AddError(
                        ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error,
                        Strings.AmbiguousFunctionOverload(function.FQName, space));
                }
                else
                {
                    SchemaTypes.Add(function);
                }
            }
        }