コード例 #1
0
ファイル: FunctionImport.cs プロジェクト: larsenjo/odata.net
 /// <summary>
 /// Adds a new parameter to this function
 /// </summary>
 /// <param name="parameter">The parameter to be added</param>
 public void Add(FunctionParameter parameter)
 {
     this.Parameters.Add(parameter);
 }
コード例 #2
0
 /// <summary>
 /// Adds a new parameter to this function
 /// </summary>
 /// <param name="parameter">The parameter to be added</param>
 public void Add(FunctionParameter parameter)
 {
     this.Parameters.Add(parameter);
 }
コード例 #3
0
ファイル: XsdlParserBase.cs プロジェクト: larsenjo/odata.net
        /// <summary>
        /// Parses a function element
        /// </summary>
        /// <param name="parameterElement">the function element in the schema file</param>
        /// <returns>the function parameter representation in the entity model schema</returns>
        protected FunctionParameter ParseFunctionParameter(XElement parameterElement)
        {
            string parameterName = parameterElement.GetRequiredAttributeValue("Name");

            DataType parameterType;
            string parameterTypeName = parameterElement.GetOptionalAttributeValue("Type", null);
            bool isNullable = XmlConvert.ToBoolean(parameterElement.GetOptionalAttributeValue("Nullable", "true"));
            if (parameterTypeName != null)
            {
                parameterType = this.ParseType(parameterTypeName, isNullable, parameterElement.Attributes());
            }
            else
            {
                var parameterTypeElement = parameterElement.Elements().Single(e => this.IsXsdlNamespace(e.Name.NamespaceName));
                parameterType = this.ParseType(parameterTypeElement);
            }

            FunctionParameter parameter = new FunctionParameter()
            {
                Name = parameterName,
                DataType = parameterType,
            };

            string parameterMode = parameterElement.GetOptionalAttributeValue("Mode", null);
            if (parameterMode != null)
            {
                parameter.Mode = (FunctionParameterMode)Enum.Parse(typeof(FunctionParameterMode), parameterMode, true);
            }

            this.ParseAnnotations(parameter, parameterElement);
            return parameter;
        }
コード例 #4
0
        private FunctionParameter ConvertToTaupoFunctionParameter(IEdmOperationParameter edmOperationParameter)
        {
            var taupoFunctionParameter = new FunctionParameter()
            {
                Name = edmOperationParameter.Name,
                DataType = this.ConvertToTaupoDataType(edmOperationParameter.Type),
                Mode = FunctionParameterMode.In
            };

            this.ConvertAnnotationsIntoTaupo(edmOperationParameter, taupoFunctionParameter);
            return taupoFunctionParameter;
        }
コード例 #5
0
 private static void AddDataGenerationHints(FunctionParameter parameter, Type clrType)
 {
     DataGenerationHint[] hints;
     if (predefinedHintsPerType.TryGetValue(clrType, out hints))
     {
         parameter.WithDataGenerationHints(hints);
     }
 }
コード例 #6
0
        private void CompareFunctionParameter(FunctionParameter expectedParameter, FunctionParameter actualPrameter, string context)
        {
            this.SatisfiesEquals(expectedParameter.Name, actualPrameter.Name, "Parameter name does not match for " + context);
            this.SatisfiesEquals(expectedParameter.Mode, actualPrameter.Mode, "Mode does not match for " + context);

            this.CompareDataType(expectedParameter.DataType, actualPrameter.DataType, context);
        }
コード例 #7
0
        private DatabaseFunctionParameter ConvertToDatabaseFunctionParameter(FunctionParameter parameter)
        {
            var type = ((PrimitiveDataType)parameter.DataType).Clone();
            var mode = this.parameterModeMapping[parameter.Mode];
            var databaseFunctionParameter = new DatabaseFunctionParameter(parameter.Name, type, mode);
            this.ApplyDataGeneratorAnnotationToStoreItem(databaseFunctionParameter, parameter);

            return databaseFunctionParameter;
        }
コード例 #8
0
        /// <summary>
        /// Sets the data generator for the given function parameter and returns the parameter back.
        /// </summary>
        /// <param name="functionParameter">The function parameter to set the data generator for.</param>
        /// <param name="dataGenerator">The data generator.</param>
        /// <returns>This instance (can be used to chain calls together).</returns>
        public static FunctionParameter WithDataGenerator(this FunctionParameter functionParameter, IDataGenerator dataGenerator)
        {
            ExceptionUtilities.CheckArgumentNotNull(functionParameter, "functionParameter");

            return(functionParameter.WithDataGeneratorInternal(dataGenerator));
        }
コード例 #9
0
 /// <summary>
 /// Adds data generation hints for the given function parameter.
 /// </summary>
 /// <param name="functionParameter">Function parameter to add data generation hints to.</param>
 /// <param name="hints">Data generation hints.</param>
 /// <returns>This instance (can be used to chain calls together).</returns>
 public static FunctionParameter WithDataGenerationHints(this FunctionParameter functionParameter, params DataGenerationHint[] hints)
 {
     ExceptionUtilities.CheckArgumentNotNull(functionParameter, "functionParameter");
     return(functionParameter.WithDataGenerationHintsInternal(hints));
 }
コード例 #10
0
 /// <summary>
 /// Visit function parameter
 /// </summary>
 /// <param name="parameter">function parameter to visit</param>
 protected virtual void VisitFunctionParameter(FunctionParameter parameter)
 {
     this.VisitAnnotatedItem(parameter);
 }