You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For help on the various Types below, please read https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/wiki/Common-Settings.*Types-explained
29
29
// The following entries are the only required settings.
Copy file name to clipboardExpand all lines: EntityFramework.Reverse.POCO.Generator/Database NorthwindSqlCe40.tt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
11
11
// For help on the various Types below, please read https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/wiki/Common-Settings.*Types-explained
12
12
// The following entries are the only required settings.
Settings.GeneratorType = GeneratorType.EfCore; // EfCore, Ef6, Custom. Custom edit GeneratorCustom class to provide your own implementation
16
16
Settings.UseMappingTables = false; // Must be false for TemplateType.EfCore2 & 3. If true, mapping will be used and no mapping tables will be generated. If false, all tables will be generated.
Copy file name to clipboardExpand all lines: EntityFramework.Reverse.POCO.Generator/Database.tt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
12
12
// For help on the various Types below, please read https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/wiki/Common-Settings.*Types-explained
13
13
// The following entries are the only required settings.
public static TemplateType TemplateType = TemplateType.EfCore7; // EfCore7, EfCore6, EfCore5, EfCore3, EfCore2, Ef6, FileBasedCore2-7. FileBased specify folder using Settings.TemplateFolder
45
45
public static GeneratorType GeneratorType = GeneratorType.EfCore; // EfCore, Ef6, Custom. Custom edit GeneratorCustom class to provide your own implementation
46
46
public static ForeignKeyNamingStrategy ForeignKeyNamingStrategy = ForeignKeyNamingStrategy.Legacy; // Please use Legacy for now, Latest (not yet ready)
@@ -1532,6 +1532,7 @@
1532
1532
{
1533
1533
SqlServer,
1534
1534
SqlCe,
1535
+
SQLite,
1535
1536
Plugin, // See Settings.DatabaseReaderPlugin
1536
1537
PostgreSQL,
1537
1538
MySql, // Not yet implemented
@@ -6948,6 +6949,9 @@
6948
6949
case DatabaseType.SqlCe:
6949
6950
return new SqlServerLanguageFactory();
6950
6951
6952
+
case DatabaseType.SQLite:
6953
+
return new SQLiteLanguageFactory();
6954
+
6951
6955
case DatabaseType.Plugin:
6952
6956
return new PluginLanguageFactory();
6953
6957
@@ -7053,6 +7057,24 @@
7053
7057
}
7054
7058
}
7055
7059
7060
+
public class SQLiteLanguageFactory : IDatabaseLanguageFactory
7061
+
{
7062
+
public IDatabaseToPropertyType Create()
7063
+
{
7064
+
switch (Settings.GenerationLanguage)
7065
+
{
7066
+
case GenerationLanguage.CSharp:
7067
+
return new SQLiteToCSharp();
7068
+
7069
+
case GenerationLanguage.Javascript:
7070
+
// Not yet supported
7071
+
7072
+
default:
7073
+
throw new ArgumentOutOfRangeException();
7074
+
}
7075
+
}
7076
+
}
7077
+
7056
7078
public class SqlServerLanguageFactory : IDatabaseLanguageFactory
7057
7079
{
7058
7080
public IDatabaseToPropertyType Create()
@@ -7305,6 +7327,37 @@
7305
7327
}
7306
7328
}
7307
7329
7330
+
public class SQLiteToCSharp : IDatabaseToPropertyType
7331
+
{
7332
+
// [Database type] = Language type
7333
+
public Dictionary<string, string> GetMapping()
7334
+
{
7335
+
return new Dictionary<string, string>
7336
+
{
7337
+
{ string.Empty, "string" }, // default
7338
+
{ "blob", "byte[]" },
7339
+
{ "real", "double" },
7340
+
{ "integer", "int" },
7341
+
{ "text", "string" }
7342
+
};
7343
+
}
7344
+
7345
+
public List<string> SpatialTypes()
7346
+
{
7347
+
return new List<string>();
7348
+
}
7349
+
7350
+
public List<string> PrecisionTypes()
7351
+
{
7352
+
return new List<string>();
7353
+
}
7354
+
7355
+
public List<string> PrecisionAndScaleTypes()
7356
+
{
7357
+
return new List<string>();
7358
+
}
7359
+
}
7360
+
7308
7361
public class SqlServerToCSharp : IDatabaseToPropertyType
7309
7362
{
7310
7363
// [Database type] = Language type
@@ -12317,6 +12370,9 @@ and limitations under the License.
12317
12370
case DatabaseType.SqlCe:
12318
12371
return "System.Data.SqlServerCe.4.0";
12319
12372
12373
+
case DatabaseType.SQLite:
12374
+
return "System.Data.SQLite";
12375
+
12320
12376
case DatabaseType.Plugin:
12321
12377
return string.Empty; // Not used
12322
12378
@@ -13519,6 +13575,7 @@ and limitations under the License.
13519
13575
switch (Settings.DatabaseType)
13520
13576
{
13521
13577
case DatabaseType.SqlServer:
13578
+
case DatabaseType.SQLite:
13522
13579
return new SqlServerDatabaseReader(factory, databaseToPropertyType);
13523
13580
13524
13581
case DatabaseType.SqlCe:
@@ -20097,6 +20154,9 @@ using {{this}};{{#newline}}
20097
20154
case DatabaseType.Plugin:
20098
20155
usings.Add("Microsoft.Data.SqlClient");
20099
20156
break;
20157
+
case DatabaseType.SQLite:
20158
+
usings.Add("Microsoft.Data.Sqlite");
20159
+
break;
20100
20160
case DatabaseType.PostgreSQL:
20101
20161
break;
20102
20162
case DatabaseType.MySql:
@@ -21682,6 +21742,9 @@ using {{this}};{{#newline}}
21682
21742
case DatabaseType.Plugin:
21683
21743
usings.Add("Microsoft.Data.SqlClient");
21684
21744
break;
21745
+
case DatabaseType.SQLite:
21746
+
usings.Add("Microsoft.Data.Sqlite");
21747
+
break;
21685
21748
case DatabaseType.PostgreSQL:
21686
21749
usings.Add("Npgsql");
21687
21750
usings.Add("NpgsqlTypes");
@@ -23314,6 +23377,9 @@ using {{this}};{{#newline}}
23314
23377
case DatabaseType.Plugin:
23315
23378
usings.Add("Microsoft.Data.SqlClient");
23316
23379
break;
23380
+
case DatabaseType.SQLite:
23381
+
usings.Add("Microsoft.Data.Sqlite");
23382
+
break;
23317
23383
case DatabaseType.PostgreSQL:
23318
23384
usings.Add("Npgsql");
23319
23385
usings.Add("NpgsqlTypes");
@@ -24948,6 +25014,9 @@ using {{this}};{{#newline}}
<addname="Npgsql Provider"invariant="Npgsql"description=".NET Framework Data Provider for PostgreSQL"type="Npgsql.NpgsqlFactory, Npgsql, Version=4.1.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
64
+
<addname="SQLite Data Provider (Entity Framework 6)"invariant="System.Data.SQLite.EF6"description=".NET Framework Data Provider for SQLite (Entity Framework 6)"type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
65
+
<addname="SQLite Data Provider"invariant="System.Data.SQLite"description=".NET Framework Data Provider for SQLite"type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
0 commit comments