private DatabaseFunction ConvertToDatabaseFunction(Function customFunction)
        {
            string functionName = this.GetFunctionName(customFunction);
            string schema = this.GetSchemaName(customFunction);

            var databaseFunction = new DatabaseFunction(schema, functionName);
            databaseFunction.ReturnType = this.ConvertToDatabaseType(customFunction.ReturnType);

            foreach (var parameter in customFunction.Parameters)
            {
                databaseFunction.Parameters.Add(this.ConvertToDatabaseFunctionParameter(parameter));
            }

            var bodyGenerationAnnotation = this.GetStoreFunctionBodyGenerationInfoToStoreItem(customFunction.Annotations.OfType<StoreFunctionBodyGenerationInfoAnnotation>().SingleOrDefault());
            if (bodyGenerationAnnotation != null)
            {
                databaseFunction.Annotations.Add(bodyGenerationAnnotation);
            }

            var bodyAnnotation = customFunction.Annotations.OfType<StoreFunctionBodyAnnotation>().SingleOrDefault();
            if (bodyAnnotation != null)
            {
                databaseFunction.Body = bodyAnnotation.Body;
            }

            return databaseFunction;
        }
Пример #2
0
 /// <summary>
 /// Adds given <see cref="DatabaseFunction"/> to <see cref="Functions"/> collection.
 /// </summary>
 /// <param name="function">Function to add.</param>
 public void Add(DatabaseFunction function)
 {
     this.Functions.Add(function);
 }
Пример #3
0
 /// <summary>
 /// Adds given <see cref="DatabaseFunction"/> to <see cref="Functions"/> collection.
 /// </summary>
 /// <param name="function">Function to add.</param>
 public void Add(DatabaseFunction function)
 {
     this.Functions.Add(function);
 }