-
Notifications
You must be signed in to change notification settings - Fork 0
/
LimitDBSchemaProvider.cs
39 lines (33 loc) · 1.53 KB
/
LimitDBSchemaProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using DevExpress.DataAccess.Sql;
using DevExpress.Xpo.DB;
using System.Linq;
namespace MvcDashboard_CustomSchemaProvider.Code {
public class LimitDBSchemaProvider : IDBSchemaProviderEx {
DBSchemaProviderEx provider;
public LimitDBSchemaProvider() {
this.provider = new DBSchemaProviderEx();
}
public DBTable[] GetTables(SqlDataConnection connection, params string[] tableList) {
// Returns only the tables which names start with the letter C.
return provider.GetTables(connection, tableList)
.Where(table => table.Name.StartsWith("C"))
.ToArray();
}
public DBTable[] GetViews(SqlDataConnection connection, params string[] viewList) {
// Returns only the views which names start with Sales.
return provider.GetViews(connection, viewList)
.Where(view => view.Name.StartsWith("Sales"))
.ToArray();
}
public DBStoredProcedure[] GetProcedures(SqlDataConnection connection, params string[] procedureList) {
// Returns only the stored procedures with zero argumnents.
return provider.GetProcedures(connection, procedureList)
.Where(storedProcedure => storedProcedure.Arguments.Count == 0)
.ToArray();
}
public void LoadColumns(SqlDataConnection connection, params DBTable[] tables) {
// Loads all columns in tables.
provider.LoadColumns(connection, tables);
}
}
}