@inherits RazorTemplate> @using Bring2mind.CodeGen.Cli.Common @using Bring2mind.CodeGen.Cli.Data @using Bring2mind.CodeGen.Cli.Razor @using Microsoft.SqlServer.Management.Smo @{} using System; using System.Collections.Generic; using DotNetNuke.Data; namespace @(Settings.RootNameSpace).Data { public class Sprocs { @foreach (SprocDefinition sp in Model.Values) { var objName = "object"; if (sp.ReturnObject != "") { objName = sp.ReturnObject; } @: // @Raw(System.Text.RegularExpressions.Regex.Replace(sp.Sproc.TextBody, "(\n|\r\n?)", "\r\n // ")); if (sp.ReturnsData) { @: public static IEnumerable<@objName> @(sp.Name)(@sp.Sproc.ParameterList(true, true, "", ", ")) } else { @: public static void @(sp.Name)(@sp.Sproc.ParameterList(true, true, "", ", ")) } @: { @: using (var context = DataContext.Instance()) @: { if (sp.ReturnsData) { @: return context.ExecuteQuery<@objName>(System.Data.CommandType.StoredProcedure, } else { @: context.Execute(System.Data.CommandType.StoredProcedure, } var pl = sp.Sproc.ParameterList(false, true, "", ", "); var comma = string.IsNullOrEmpty(pl) ? "" : ","; @: "@sp.Sproc.Name"@comma @: @pl); @: } @: } @: } } }