public string Format(UserDefinedFunction udf) { var server = udf.CreateWrapper(); var values = new Dictionary <string, object>(StringComparer.InvariantCultureIgnoreCase) { { Const.Catalog, udf.Parent.Name }, { Const.Schema, udf.Schema }, { Const.Name, udf.Name }, { Const.NameEscaped, udf.Name.EscapeName() }, { Const.Body, udf.TextBody }, { Const.Header, udf.ScriptHeader(true) }, { Const.Needs, GetNeeds(server, udf, DatabaseObjectTypes.StoredProcedure | DatabaseObjectTypes.UserDefinedFunction | DatabaseObjectTypes.View) ?? string.Empty } }; switch (udf.FunctionType) { case UserDefinedFunctionType.Inline: values[Const.FuncType] = Const.FuncInline; break; case UserDefinedFunctionType.Table: values[Const.FuncType] = Const.FuncMulti; break; default: values[Const.FuncType] = Const.FuncScalar; break; } return(Const.Script.UserDefinedFunction.Format().With(values)); }
public string Format(UserDefinedFunction udf) { var server = udf.CreateWrapper(); var values = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase) { { Const.Catalog, udf.Parent.Name }, { Const.Schema, udf.Schema }, { Const.Name, udf.Name }, { Const.NameEscaped, udf.Name.EscapeName() }, { Const.Body, udf.TextBody }, { Const.Header, udf.ScriptHeader(true) }, { Const.Needs, GetNeeds(server, udf, DatabaseObjectTypes.StoredProcedure | DatabaseObjectTypes.UserDefinedFunction | DatabaseObjectTypes.View) ?? string.Empty } }; switch (udf.FunctionType) { case UserDefinedFunctionType.Inline: values[Const.FuncType] = Const.FuncInline; break; case UserDefinedFunctionType.Table: values[Const.FuncType] = Const.FuncMulti; break; default: values[Const.FuncType] = Const.FuncScalar; break; } return Const.Script.UserDefinedFunction.Format().With(values); }