private static bool ProcedureExists(IEntitySchema view, ProcedureUsage usage, DbConnectionProvider connectionProvider) { var proceuredName = usage == ProcedureUsage.Insert || usage == ProcedureUsage.Update ? string.Format("{0}{1}", usage.ToString(), view.Name) : string.Format("{0}{1}Type", usage.ToString().TrimStart("Type".ToArray()), view.Name); var strComm = string.Format("Select * From sysobjects Where [xtype] = 'p' And [name] = '{0}'", proceuredName); return(connectionProvider.ExecuteLines(strComm) > 0); }
private static bool TypeExists(string name, DbConnectionProvider connectionProvider) { var strComm = string.Format("Select * From [sys].[types] Where [name] = '{0}Type';", name); return(connectionProvider.ExecuteLines(strComm) > 0); }
private static bool TableExists(ISchemaTable table, DbConnectionProvider connectionProvider) { var str = string.Format("Select * From [sys].[tables] Where [name] = '{0}'", table.Name); return(connectionProvider.ExecuteLines(str) > 0); }
private static bool ViewExists(IEntitySchema view, DbConnectionProvider connectionProvider) { var strComm = string.Format("Select * From [sys].[views] Where [object_id] = Object_Id('[v_{0}]');", view.Name); return(connectionProvider.ExecuteLines(strComm) > 0); }