subsonic 3.0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/LICENSE.txt +41 -0
- data/lib/SubSonic.Core.dll +0 -0
- data/lib/T4 Templates/ActiveRecord/ActiveRecord.tt +620 -0
- data/lib/T4 Templates/ActiveRecord/Context.tt +295 -0
- data/lib/T4 Templates/ActiveRecord/SQLServer.ttinclude +347 -0
- data/lib/T4 Templates/ActiveRecord/Settings.ttinclude +552 -0
- data/lib/T4 Templates/ActiveRecord/StoredProcedures.tt +30 -0
- data/lib/T4 Templates/ActiveRecord/Structs.tt +67 -0
- data/lib/T4 Templates/LinqTemplates/Classes.tt +117 -0
- data/lib/T4 Templates/LinqTemplates/Context.tt +276 -0
- data/lib/T4 Templates/LinqTemplates/SQLServer.ttinclude +349 -0
- data/lib/T4 Templates/LinqTemplates/Settings.ttinclude +551 -0
- data/lib/T4 Templates/LinqTemplates/StoredProcedures.tt +30 -0
- data/lib/T4 Templates/LinqTemplates/Structs.tt +67 -0
- data/lib/T4 Templates/README.txt +7 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/ActiveRecord.tt +560 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/ActiveRecord.vb +6447 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Context.tt +258 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Context.vb +349 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/SQLServer.ttinclude +332 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Settings.ttinclude +550 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/StoredProcedures.tt +30 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/StoredProcedures.vb +55 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Structs.tt +57 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Structs.vb +1478 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/ActiveRecord/Tests/FetchTests.vb +52 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/App.config +9 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Application.Designer.vb +13 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Application.myapp +10 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/AssemblyInfo.vb +35 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Resources.Designer.vb +63 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Resources.resx +117 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Settings.Designer.vb +73 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/My Project/Settings.settings +7 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/SubSonic.TemplatesVB.vbproj +171 -0
- data/lib/T4 Templates/SubSonic.TemplatesVB/SubSonic.TemplatesVB.vbproj.user +5 -0
- data/lib/T4 Templates/TemplateProviders/MySQL.ttinclude +278 -0
- data/lib/T4 Templates/TemplateProviders/MySQL.ttinclude.orig +303 -0
- data/lib/T4 Templates/TemplateProviders/MySQLTest.tt +27 -0
- data/lib/T4 Templates/TemplateProviders/SQLite.ttinclude +194 -0
- data/lib/T4 Templates/TemplateProviders/SQLite.ttinclude.orig +236 -0
- data/lib/T4 Templates/TemplateProviders/SQLiteTest.tt +27 -0
- data/lib/T4 Templates/TemplateProviders/Settings.ttinclude +551 -0
- metadata +112 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<#@ template language="C#v3.5" debug="False" hostspecific="True" #>
|
2
|
+
<#@ output extension=".cs" #>
|
3
|
+
<#@ include file="SQLServer.ttinclude" #>
|
4
|
+
<#
|
5
|
+
var sps = GetSPs();
|
6
|
+
if(sps.Count>0){
|
7
|
+
#>
|
8
|
+
using System;
|
9
|
+
using SubSonic;
|
10
|
+
using SubSonic.Schema;
|
11
|
+
using SubSonic.DataProviders;
|
12
|
+
using System.Data;
|
13
|
+
|
14
|
+
namespace <#=Namespace#>{
|
15
|
+
public partial class <#=DatabaseName#>DB{
|
16
|
+
|
17
|
+
<# foreach(var sp in sps){#>
|
18
|
+
public StoredProcedure <#=sp.CleanName#>(<#=sp.ArgList#>){
|
19
|
+
StoredProcedure sp=new StoredProcedure("<#=sp.Name#>",this.Provider);
|
20
|
+
<# foreach(var par in sp.Parameters){#>
|
21
|
+
sp.Command.AddParameter("<#=par.Name#>",<#=par.CleanName#>,DbType.<#=par.DbType#>);
|
22
|
+
<# }#>
|
23
|
+
return sp;
|
24
|
+
}
|
25
|
+
<# }#>
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
}
|
30
|
+
<# }#>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<#@ template language="C#v3.5" debug="False" hostspecific="True" #>
|
2
|
+
<#@ output extension=".cs" #>
|
3
|
+
<#@ include file="SQLServer.ttinclude" #>
|
4
|
+
<#
|
5
|
+
var tables = LoadTables();
|
6
|
+
#>
|
7
|
+
using System;
|
8
|
+
using SubSonic.Schema;
|
9
|
+
using System.Collections.Generic;
|
10
|
+
using SubSonic.DataProviders;
|
11
|
+
using System.Data;
|
12
|
+
|
13
|
+
namespace <#=Namespace#> {
|
14
|
+
|
15
|
+
<# foreach(var tbl in tables){
|
16
|
+
if(!ExcludeTables.Contains(tbl.Name))
|
17
|
+
{
|
18
|
+
#>
|
19
|
+
/// <summary>
|
20
|
+
/// Table: <#=tbl.Name#>
|
21
|
+
/// Primary Key: <#=tbl.PrimaryKey#>
|
22
|
+
/// </summary>
|
23
|
+
|
24
|
+
public class <#=tbl.CleanName#>Table: DatabaseTable {
|
25
|
+
|
26
|
+
public <#=tbl.CleanName#>Table(IDataProvider provider):base("<#=tbl.Name#>",provider){
|
27
|
+
ClassName = "<#=tbl.ClassName#>";
|
28
|
+
SchemaName = "<#=tbl.Schema ?? ""#>";
|
29
|
+
|
30
|
+
<# foreach(var col in tbl.Columns){#>
|
31
|
+
|
32
|
+
Columns.Add(new DatabaseColumn("<#=col.Name#>", this)
|
33
|
+
{
|
34
|
+
IsPrimaryKey = <#=col.IsPK.ToString().ToLower()#>,
|
35
|
+
DataType = DbType.<#=col.DbType.ToString()#>,
|
36
|
+
IsNullable = <#=col.IsNullable.ToString().ToLower()#>,
|
37
|
+
AutoIncrement = <#=col.AutoIncrement.ToString().ToLower()#>,
|
38
|
+
IsForeignKey = <#=col.IsForeignKey.ToString().ToLower()#>,
|
39
|
+
MaxLength = <#=col.MaxLength#>
|
40
|
+
});
|
41
|
+
<# }#>
|
42
|
+
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
<# foreach(var col in tbl.Columns){#>
|
47
|
+
public IColumn <#=col.CleanName#>{
|
48
|
+
get{
|
49
|
+
return this.GetColumn("<#=col.Name#>");
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
public static string <#= col.CleanName #>Column{
|
54
|
+
get{
|
55
|
+
return "<#= col.Name #>";
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
<# }#>
|
60
|
+
}
|
61
|
+
|
62
|
+
<#
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|
66
|
+
#>
|
67
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<#@ template language="C#v3.5" debug="False" hostspecific="True" #>
|
2
|
+
<#@ output extension=".cs" #>
|
3
|
+
<#@ include file="SQLServer.ttinclude" #>
|
4
|
+
<#
|
5
|
+
var tables = LoadTables();
|
6
|
+
#>
|
7
|
+
using System;
|
8
|
+
using System.ComponentModel;
|
9
|
+
using System.Linq;
|
10
|
+
|
11
|
+
namespace <#=Namespace#>
|
12
|
+
{
|
13
|
+
|
14
|
+
|
15
|
+
<# foreach(Table tbl in tables){#>
|
16
|
+
|
17
|
+
/// <summary>
|
18
|
+
/// A class which represents the <#=tbl.Name#> table in the <#=DatabaseName#> Database.
|
19
|
+
/// This class is queryable through <#=DatabaseName#>DB.<#=tbl.ClassName#>
|
20
|
+
/// </summary>
|
21
|
+
|
22
|
+
public partial class <#=tbl.ClassName#>: INotifyPropertyChanging, INotifyPropertyChanged
|
23
|
+
{
|
24
|
+
partial void OnLoaded();
|
25
|
+
partial void OnValidate(System.Data.Linq.ChangeAction action);
|
26
|
+
partial void OnCreated();
|
27
|
+
|
28
|
+
public <#=tbl.ClassName#>(){
|
29
|
+
OnCreated();
|
30
|
+
}
|
31
|
+
|
32
|
+
#region Properties
|
33
|
+
|
34
|
+
<# foreach(var col in tbl.Columns){
|
35
|
+
if (tbl.ClassName == col.CleanName)
|
36
|
+
{
|
37
|
+
col.CleanName += "X";
|
38
|
+
}
|
39
|
+
#>
|
40
|
+
partial void On<#=col.CleanName#>Changing(<#=col.SysType#><#=CheckNullable(col)#> value);
|
41
|
+
partial void On<#=col.CleanName#>Changed();
|
42
|
+
|
43
|
+
private <#=col.SysType#><#=CheckNullable(col)#> _<#=col.CleanName#>;
|
44
|
+
public <#=col.SysType#><#=CheckNullable(col)#> <#=col.CleanName#> {
|
45
|
+
get{
|
46
|
+
return _<#=col.CleanName#>;
|
47
|
+
}
|
48
|
+
set{
|
49
|
+
this.On<#=col.CleanName#>Changing(value);
|
50
|
+
this.SendPropertyChanging();
|
51
|
+
this._<#=col.CleanName#> = value;
|
52
|
+
this.SendPropertyChanged("<#=col.CleanName#>");
|
53
|
+
this.On<#=col.CleanName#>Changed();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
<# }#>
|
58
|
+
|
59
|
+
#endregion
|
60
|
+
|
61
|
+
#region Foreign Keys
|
62
|
+
<#
|
63
|
+
List<string> fkCreated = new List<string>();
|
64
|
+
foreach(FKTable fk in tbl.FKTables)
|
65
|
+
{
|
66
|
+
|
67
|
+
if(!ExcludeTables.Contains(fk.OtherTable)){
|
68
|
+
string propName=fk.OtherQueryable;
|
69
|
+
if(fkCreated.Contains(propName))
|
70
|
+
{
|
71
|
+
propName=fk.OtherQueryable+fkCreated.Count.ToString();
|
72
|
+
}
|
73
|
+
|
74
|
+
fkCreated.Add(fk.OtherQueryable);
|
75
|
+
|
76
|
+
|
77
|
+
#>
|
78
|
+
public IQueryable<<#=fk.OtherClass #>> <#=propName #>
|
79
|
+
{
|
80
|
+
get
|
81
|
+
{
|
82
|
+
var db=new <#=Namespace #>.<#=DatabaseName#>DB();
|
83
|
+
return from items in db.<#=fk.OtherQueryable #>
|
84
|
+
where items.<#=fk.OtherColumn#> == _<#=fk.ThisColumn#>
|
85
|
+
select items;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
<#
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
#>
|
94
|
+
#endregion
|
95
|
+
|
96
|
+
|
97
|
+
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
|
98
|
+
public event PropertyChangingEventHandler PropertyChanging;
|
99
|
+
public event PropertyChangedEventHandler PropertyChanged;
|
100
|
+
protected virtual void SendPropertyChanging()
|
101
|
+
{
|
102
|
+
var handler = PropertyChanging;
|
103
|
+
if (handler != null)
|
104
|
+
handler(this, emptyChangingEventArgs);
|
105
|
+
}
|
106
|
+
|
107
|
+
protected virtual void SendPropertyChanged(String propertyName)
|
108
|
+
{
|
109
|
+
var handler = PropertyChanged;
|
110
|
+
if (handler != null)
|
111
|
+
handler(this, new PropertyChangedEventArgs(propertyName));
|
112
|
+
}
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
<#}#>
|
117
|
+
}
|
@@ -0,0 +1,276 @@
|
|
1
|
+
<#@ template language="C#v3.5" debug="False" hostspecific="True" #>
|
2
|
+
<#@ output extension=".cs" #>
|
3
|
+
<#@ include file="SQLServer.ttinclude" #>
|
4
|
+
<#
|
5
|
+
var tables = LoadTables();
|
6
|
+
#>
|
7
|
+
using System;
|
8
|
+
using System.Data;
|
9
|
+
using System.Linq;
|
10
|
+
using System.Linq.Expressions;
|
11
|
+
using SubSonic.DataProviders;
|
12
|
+
using SubSonic.Extensions;
|
13
|
+
using SubSonic.Linq.Structure;
|
14
|
+
using SubSonic.Query;
|
15
|
+
using SubSonic.Schema;
|
16
|
+
using System.Data.Common;
|
17
|
+
using System.Collections.Generic;
|
18
|
+
|
19
|
+
namespace <#=Namespace#>
|
20
|
+
{
|
21
|
+
public partial class <#=DatabaseName#>DB : IQuerySurface
|
22
|
+
{
|
23
|
+
|
24
|
+
public IDataProvider DataProvider;
|
25
|
+
public DbQueryProvider provider;
|
26
|
+
|
27
|
+
public bool TestMode
|
28
|
+
{
|
29
|
+
get
|
30
|
+
{
|
31
|
+
return DataProvider.ConnectionString.Equals("test", StringComparison.InvariantCultureIgnoreCase);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
public <#=DatabaseName#>DB()
|
36
|
+
{
|
37
|
+
DataProvider = ProviderFactory.GetProvider("<#=ConnectionStringName#>");
|
38
|
+
Init();
|
39
|
+
}
|
40
|
+
|
41
|
+
public <#=DatabaseName#>DB(string connectionStringName)
|
42
|
+
{
|
43
|
+
DataProvider = ProviderFactory.GetProvider(connectionStringName);
|
44
|
+
Init();
|
45
|
+
}
|
46
|
+
|
47
|
+
public <#=DatabaseName#>DB(string connectionString, string providerName)
|
48
|
+
{
|
49
|
+
DataProvider = ProviderFactory.GetProvider(connectionString,providerName);
|
50
|
+
Init();
|
51
|
+
}
|
52
|
+
|
53
|
+
public ITable FindByPrimaryKey(string pkName)
|
54
|
+
{
|
55
|
+
return DataProvider.Schema.Tables.SingleOrDefault(x => x.PrimaryKey.Name.Equals(pkName, StringComparison.InvariantCultureIgnoreCase));
|
56
|
+
}
|
57
|
+
|
58
|
+
public Query<T> GetQuery<T>()
|
59
|
+
{
|
60
|
+
return new Query<T>(provider);
|
61
|
+
}
|
62
|
+
|
63
|
+
public ITable FindTable(string tableName)
|
64
|
+
{
|
65
|
+
return DataProvider.FindTable(tableName);
|
66
|
+
}
|
67
|
+
|
68
|
+
public IDataProvider Provider
|
69
|
+
{
|
70
|
+
get { return DataProvider; }
|
71
|
+
set {DataProvider=value;}
|
72
|
+
}
|
73
|
+
|
74
|
+
public DbQueryProvider QueryProvider
|
75
|
+
{
|
76
|
+
get { return provider; }
|
77
|
+
}
|
78
|
+
|
79
|
+
BatchQuery _batch = null;
|
80
|
+
public void Queue<T>(IQueryable<T> qry)
|
81
|
+
{
|
82
|
+
if (_batch == null)
|
83
|
+
_batch = new BatchQuery(Provider, QueryProvider);
|
84
|
+
_batch.Queue(qry);
|
85
|
+
}
|
86
|
+
|
87
|
+
public void Queue(ISqlQuery qry)
|
88
|
+
{
|
89
|
+
if (_batch == null)
|
90
|
+
_batch = new BatchQuery(Provider, QueryProvider);
|
91
|
+
_batch.Queue(qry);
|
92
|
+
}
|
93
|
+
|
94
|
+
public void ExecuteTransaction(IList<DbCommand> commands)
|
95
|
+
{
|
96
|
+
if(!TestMode)
|
97
|
+
{
|
98
|
+
using(var connection = commands[0].Connection)
|
99
|
+
{
|
100
|
+
if (connection.State == ConnectionState.Closed)
|
101
|
+
connection.Open();
|
102
|
+
|
103
|
+
using (var trans = connection.BeginTransaction())
|
104
|
+
{
|
105
|
+
foreach (var cmd in commands)
|
106
|
+
{
|
107
|
+
cmd.Transaction = trans;
|
108
|
+
cmd.Connection = connection;
|
109
|
+
cmd.ExecuteNonQuery();
|
110
|
+
}
|
111
|
+
trans.Commit();
|
112
|
+
}
|
113
|
+
connection.Close();
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
public IDataReader ExecuteBatch()
|
119
|
+
{
|
120
|
+
if (_batch == null)
|
121
|
+
throw new InvalidOperationException("There's nothing in the queue");
|
122
|
+
if(!TestMode)
|
123
|
+
return _batch.ExecuteReader();
|
124
|
+
return null;
|
125
|
+
}
|
126
|
+
<# //################################################ IQueryable ####################################### #>
|
127
|
+
<# foreach(Table tbl in tables){
|
128
|
+
if(!ExcludeTables.Contains(tbl.Name))
|
129
|
+
{
|
130
|
+
#>
|
131
|
+
public Query<<#=tbl.ClassName#>> <#=tbl.QueryableName#> { get; set; }
|
132
|
+
<#
|
133
|
+
}
|
134
|
+
}
|
135
|
+
#>
|
136
|
+
|
137
|
+
<# //################################################ Aggregates and Queries ####################################### #>
|
138
|
+
|
139
|
+
#region ' Aggregates and SubSonic Queries '
|
140
|
+
public Select SelectColumns(params string[] columns)
|
141
|
+
{
|
142
|
+
return new Select(DataProvider, columns);
|
143
|
+
}
|
144
|
+
|
145
|
+
public Select Select
|
146
|
+
{
|
147
|
+
get { return new Select(this.Provider); }
|
148
|
+
}
|
149
|
+
|
150
|
+
public Insert Insert
|
151
|
+
{
|
152
|
+
get { return new Insert(this.Provider); }
|
153
|
+
}
|
154
|
+
|
155
|
+
public Update<T> Update<T>() where T:new()
|
156
|
+
{
|
157
|
+
return new Update<T>(this.Provider);
|
158
|
+
}
|
159
|
+
|
160
|
+
public SqlQuery Delete<T>(Expression<Func<T,bool>> column) where T:new()
|
161
|
+
{
|
162
|
+
LambdaExpression lamda = column;
|
163
|
+
SqlQuery result = new Delete<T>(this.Provider);
|
164
|
+
result = result.From<T>();
|
165
|
+
result.Constraints=lamda.ParseConstraints().ToList();
|
166
|
+
return result;
|
167
|
+
}
|
168
|
+
|
169
|
+
public SqlQuery Max<T>(Expression<Func<T,object>> column)
|
170
|
+
{
|
171
|
+
LambdaExpression lamda = column;
|
172
|
+
string colName = lamda.ParseObjectValue();
|
173
|
+
string objectName = typeof(T).Name;
|
174
|
+
string tableName = DataProvider.FindTable(objectName).Name;
|
175
|
+
return new Select(DataProvider, new Aggregate(colName, AggregateFunction.Max)).From(tableName);
|
176
|
+
}
|
177
|
+
|
178
|
+
public SqlQuery Min<T>(Expression<Func<T,object>> column)
|
179
|
+
{
|
180
|
+
LambdaExpression lamda = column;
|
181
|
+
string colName = lamda.ParseObjectValue();
|
182
|
+
string objectName = typeof(T).Name;
|
183
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
184
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.Min)).From(tableName);
|
185
|
+
}
|
186
|
+
|
187
|
+
public SqlQuery Sum<T>(Expression<Func<T,object>> column)
|
188
|
+
{
|
189
|
+
LambdaExpression lamda = column;
|
190
|
+
string colName = lamda.ParseObjectValue();
|
191
|
+
string objectName = typeof(T).Name;
|
192
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
193
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.Sum)).From(tableName);
|
194
|
+
}
|
195
|
+
|
196
|
+
public SqlQuery Avg<T>(Expression<Func<T,object>> column)
|
197
|
+
{
|
198
|
+
LambdaExpression lamda = column;
|
199
|
+
string colName = lamda.ParseObjectValue();
|
200
|
+
string objectName = typeof(T).Name;
|
201
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
202
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.Avg)).From(tableName);
|
203
|
+
}
|
204
|
+
|
205
|
+
public SqlQuery Count<T>(Expression<Func<T,object>> column)
|
206
|
+
{
|
207
|
+
LambdaExpression lamda = column;
|
208
|
+
string colName = lamda.ParseObjectValue();
|
209
|
+
string objectName = typeof(T).Name;
|
210
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
211
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.Count)).From(tableName);
|
212
|
+
}
|
213
|
+
|
214
|
+
public SqlQuery Variance<T>(Expression<Func<T,object>> column)
|
215
|
+
{
|
216
|
+
LambdaExpression lamda = column;
|
217
|
+
string colName = lamda.ParseObjectValue();
|
218
|
+
string objectName = typeof(T).Name;
|
219
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
220
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.Var)).From(tableName);
|
221
|
+
}
|
222
|
+
|
223
|
+
public SqlQuery StandardDeviation<T>(Expression<Func<T,object>> column)
|
224
|
+
{
|
225
|
+
LambdaExpression lamda = column;
|
226
|
+
string colName = lamda.ParseObjectValue();
|
227
|
+
string objectName = typeof(T).Name;
|
228
|
+
string tableName = this.Provider.FindTable(objectName).Name;
|
229
|
+
return new Select(this.Provider, new Aggregate(colName, AggregateFunction.StDev)).From(tableName);
|
230
|
+
}
|
231
|
+
|
232
|
+
#endregion
|
233
|
+
|
234
|
+
void Init()
|
235
|
+
{
|
236
|
+
provider = new DbQueryProvider(this.Provider);
|
237
|
+
|
238
|
+
<#
|
239
|
+
//################################################ QUERIES ####################################### #>
|
240
|
+
#region ' Query Defs '
|
241
|
+
<#
|
242
|
+
foreach(Table tbl in tables)
|
243
|
+
{
|
244
|
+
if(!ExcludeTables.Contains(tbl.Name))
|
245
|
+
{
|
246
|
+
#>
|
247
|
+
<#=tbl.QueryableName#> = new Query<<#=tbl.ClassName#>>(provider);
|
248
|
+
<#
|
249
|
+
}
|
250
|
+
#>
|
251
|
+
<#
|
252
|
+
}
|
253
|
+
#>
|
254
|
+
#endregion
|
255
|
+
|
256
|
+
<#//################################################ SCHEMAS ####################################### #>
|
257
|
+
|
258
|
+
#region ' Schemas '
|
259
|
+
if(DataProvider.Schema.Tables.Count == 0)
|
260
|
+
{
|
261
|
+
<#
|
262
|
+
foreach(Table tbl in tables)
|
263
|
+
{
|
264
|
+
if(!ExcludeTables.Contains(tbl.Name))
|
265
|
+
{
|
266
|
+
#>
|
267
|
+
DataProvider.Schema.Tables.Add(new <#=tbl.CleanName#>Table(DataProvider));
|
268
|
+
<#
|
269
|
+
}
|
270
|
+
}
|
271
|
+
#>
|
272
|
+
}
|
273
|
+
#endregion
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|