public static IEnumerable <Script> GetScripts() { var dbc = new SqlDbClient(ConnString); return(dbc.GetQuery(cmd => { cmd.CommandText = "sp_getScripts"; cmd.CommandType = CommandType.StoredProcedure; }) .AsEnumerable() .Select(s => new Script(s))); }
public static Script GetScript(int scriptId) { var dbc = new SqlDbClient(ConnString); return(dbc.GetQuery(cmd => { cmd.CommandText = "sp_getScript"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@scriptId", scriptId)); }) .AsEnumerable() .Select(s => new Script(s)) .FirstOrDefault()); }