Skip to content

Commit 29a1bbb

Browse files
committed
Use the more efficient ToTable call so the schema does not have to be parsed out.
1 parent 7f9b5c5 commit 29a1bbb

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

EntityFramework.Reverse.POCO.Generator/Database.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ public AlphabeticalListOfProductConfiguration()
14381438

14391439
public AlphabeticalListOfProductConfiguration(string schema)
14401440
{
1441-
ToTable(schema + ".Alphabetical list of products");
1441+
ToTable("Alphabetical list of products", schema);
14421442
HasKey(x => new { x.ProductId, x.ProductName, x.Discontinued, x.CategoryName });
14431443

14441444
Property(x => x.ProductId).HasColumnName(@"ProductID").IsRequired().HasColumnType("int");
@@ -1466,7 +1466,7 @@ public CategoryConfiguration()
14661466

14671467
public CategoryConfiguration(string schema)
14681468
{
1469-
ToTable(schema + ".Categories");
1469+
ToTable("Categories", schema);
14701470
HasKey(x => x.CategoryId);
14711471

14721472
Property(x => x.CategoryId).HasColumnName(@"CategoryID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -1487,7 +1487,7 @@ public CategorySalesFor1997Configuration()
14871487

14881488
public CategorySalesFor1997Configuration(string schema)
14891489
{
1490-
ToTable(schema + ".Category Sales for 1997");
1490+
ToTable("Category Sales for 1997", schema);
14911491
HasKey(x => x.CategoryName);
14921492

14931493
Property(x => x.CategoryName).HasColumnName(@"CategoryName").IsRequired().HasColumnType("nvarchar").HasMaxLength(15);
@@ -1506,7 +1506,7 @@ public CurrentProductListConfiguration()
15061506

15071507
public CurrentProductListConfiguration(string schema)
15081508
{
1509-
ToTable(schema + ".Current Product List");
1509+
ToTable("Current Product List", schema);
15101510
HasKey(x => new { x.ProductId, x.ProductName });
15111511

15121512
Property(x => x.ProductId).HasColumnName(@"ProductID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -1525,7 +1525,7 @@ public CustomerConfiguration()
15251525

15261526
public CustomerConfiguration(string schema)
15271527
{
1528-
ToTable(schema + ".Customers");
1528+
ToTable("Customers", schema);
15291529
HasKey(x => x.CustomerId);
15301530

15311531
Property(x => x.CustomerId).HasColumnName(@"CustomerID").IsRequired().IsFixedLength().HasColumnType("nchar").HasMaxLength(5).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
@@ -1559,7 +1559,7 @@ public CustomerAndSuppliersByCityConfiguration()
15591559

15601560
public CustomerAndSuppliersByCityConfiguration(string schema)
15611561
{
1562-
ToTable(schema + ".Customer and Suppliers by City");
1562+
ToTable("Customer and Suppliers by City", schema);
15631563
HasKey(x => new { x.CompanyName, x.Relationship });
15641564

15651565
Property(x => x.City).HasColumnName(@"City").IsOptional().HasColumnType("nvarchar").HasMaxLength(15);
@@ -1580,7 +1580,7 @@ public CustomerDemographicConfiguration()
15801580

15811581
public CustomerDemographicConfiguration(string schema)
15821582
{
1583-
ToTable(schema + ".CustomerDemographics");
1583+
ToTable("CustomerDemographics", schema);
15841584
HasKey(x => x.CustomerTypeId);
15851585

15861586
Property(x => x.CustomerTypeId).HasColumnName(@"CustomerTypeID").IsRequired().IsFixedLength().HasColumnType("nchar").HasMaxLength(10).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
@@ -1599,7 +1599,7 @@ public EmployeeConfiguration()
15991599

16001600
public EmployeeConfiguration(string schema)
16011601
{
1602-
ToTable(schema + ".Employees");
1602+
ToTable("Employees", schema);
16031603
HasKey(x => x.EmployeeId);
16041604

16051605
Property(x => x.EmployeeId).HasColumnName(@"EmployeeID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -1643,7 +1643,7 @@ public InvoiceConfiguration()
16431643

16441644
public InvoiceConfiguration(string schema)
16451645
{
1646-
ToTable(schema + ".Invoices");
1646+
ToTable("Invoices", schema);
16471647
HasKey(x => new { x.CustomerName, x.Salesperson, x.OrderId, x.ShipperName, x.ProductId, x.ProductName, x.UnitPrice, x.Quantity, x.Discount });
16481648

16491649
Property(x => x.ShipName).HasColumnName(@"ShipName").IsOptional().HasColumnType("nvarchar").HasMaxLength(40);
@@ -1686,7 +1686,7 @@ public OrderConfiguration()
16861686

16871687
public OrderConfiguration(string schema)
16881688
{
1689-
ToTable(schema + ".Orders");
1689+
ToTable("Orders", schema);
16901690
HasKey(x => x.OrderId);
16911691

16921692
Property(x => x.OrderId).HasColumnName(@"OrderID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -1722,7 +1722,7 @@ public OrderDetailConfiguration()
17221722

17231723
public OrderDetailConfiguration(string schema)
17241724
{
1725-
ToTable(schema + ".Order Details");
1725+
ToTable("Order Details", schema);
17261726
HasKey(x => new { x.OrderId, x.ProductId });
17271727

17281728
Property(x => x.OrderId).HasColumnName(@"OrderID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
@@ -1748,7 +1748,7 @@ public OrderDetailsExtendedConfiguration()
17481748

17491749
public OrderDetailsExtendedConfiguration(string schema)
17501750
{
1751-
ToTable(schema + ".Order Details Extended");
1751+
ToTable("Order Details Extended", schema);
17521752
HasKey(x => new { x.OrderId, x.ProductId, x.ProductName, x.UnitPrice, x.Quantity, x.Discount });
17531753

17541754
Property(x => x.OrderId).HasColumnName(@"OrderID").IsRequired().HasColumnType("int");
@@ -1772,7 +1772,7 @@ public OrdersQryConfiguration()
17721772

17731773
public OrdersQryConfiguration(string schema)
17741774
{
1775-
ToTable(schema + ".Orders Qry");
1775+
ToTable("Orders Qry", schema);
17761776
HasKey(x => new { x.OrderId, x.CompanyName });
17771777

17781778
Property(x => x.OrderId).HasColumnName(@"OrderID").IsRequired().HasColumnType("int");
@@ -1809,7 +1809,7 @@ public OrderSubtotalConfiguration()
18091809

18101810
public OrderSubtotalConfiguration(string schema)
18111811
{
1812-
ToTable(schema + ".Order Subtotals");
1812+
ToTable("Order Subtotals", schema);
18131813
HasKey(x => x.OrderId);
18141814

18151815
Property(x => x.OrderId).HasColumnName(@"OrderID").IsRequired().HasColumnType("int");
@@ -1828,7 +1828,7 @@ public ProductConfiguration()
18281828

18291829
public ProductConfiguration(string schema)
18301830
{
1831-
ToTable(schema + ".Products");
1831+
ToTable("Products", schema);
18321832
HasKey(x => x.ProductId);
18331833

18341834
Property(x => x.ProductId).HasColumnName(@"ProductID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -1859,7 +1859,7 @@ public ProductsAboveAveragePriceConfiguration()
18591859

18601860
public ProductsAboveAveragePriceConfiguration(string schema)
18611861
{
1862-
ToTable(schema + ".Products Above Average Price");
1862+
ToTable("Products Above Average Price", schema);
18631863
HasKey(x => x.ProductName);
18641864

18651865
Property(x => x.ProductName).HasColumnName(@"ProductName").IsRequired().HasColumnType("nvarchar").HasMaxLength(40);
@@ -1878,7 +1878,7 @@ public ProductSalesFor1997Configuration()
18781878

18791879
public ProductSalesFor1997Configuration(string schema)
18801880
{
1881-
ToTable(schema + ".Product Sales for 1997");
1881+
ToTable("Product Sales for 1997", schema);
18821882
HasKey(x => new { x.CategoryName, x.ProductName });
18831883

18841884
Property(x => x.CategoryName).HasColumnName(@"CategoryName").IsRequired().HasColumnType("nvarchar").HasMaxLength(15);
@@ -1898,7 +1898,7 @@ public ProductsByCategoryConfiguration()
18981898

18991899
public ProductsByCategoryConfiguration(string schema)
19001900
{
1901-
ToTable(schema + ".Products by Category");
1901+
ToTable("Products by Category", schema);
19021902
HasKey(x => new { x.CategoryName, x.ProductName, x.Discontinued });
19031903

19041904
Property(x => x.CategoryName).HasColumnName(@"CategoryName").IsRequired().HasColumnType("nvarchar").HasMaxLength(15);
@@ -1920,7 +1920,7 @@ public RegionConfiguration()
19201920

19211921
public RegionConfiguration(string schema)
19221922
{
1923-
ToTable(schema + ".Region");
1923+
ToTable("Region", schema);
19241924
HasKey(x => x.RegionId);
19251925

19261926
Property(x => x.RegionId).HasColumnName(@"RegionID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
@@ -1939,7 +1939,7 @@ public SalesByCategoryConfiguration()
19391939

19401940
public SalesByCategoryConfiguration(string schema)
19411941
{
1942-
ToTable(schema + ".Sales by Category");
1942+
ToTable("Sales by Category", schema);
19431943
HasKey(x => new { x.CategoryId, x.CategoryName, x.ProductName });
19441944

19451945
Property(x => x.CategoryId).HasColumnName(@"CategoryID").IsRequired().HasColumnType("int");
@@ -1960,7 +1960,7 @@ public SalesTotalsByAmountConfiguration()
19601960

19611961
public SalesTotalsByAmountConfiguration(string schema)
19621962
{
1963-
ToTable(schema + ".Sales Totals by Amount");
1963+
ToTable("Sales Totals by Amount", schema);
19641964
HasKey(x => new { x.OrderId, x.CompanyName });
19651965

19661966
Property(x => x.SaleAmount).HasColumnName(@"SaleAmount").IsOptional().HasColumnType("money").HasPrecision(19,4);
@@ -1981,7 +1981,7 @@ public ShipperConfiguration()
19811981

19821982
public ShipperConfiguration(string schema)
19831983
{
1984-
ToTable(schema + ".Shippers");
1984+
ToTable("Shippers", schema);
19851985
HasKey(x => x.ShipperId);
19861986

19871987
Property(x => x.ShipperId).HasColumnName(@"ShipperID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -2001,7 +2001,7 @@ public SummaryOfSalesByQuarterConfiguration()
20012001

20022002
public SummaryOfSalesByQuarterConfiguration(string schema)
20032003
{
2004-
ToTable(schema + ".Summary of Sales by Quarter");
2004+
ToTable("Summary of Sales by Quarter", schema);
20052005
HasKey(x => x.OrderId);
20062006

20072007
Property(x => x.ShippedDate).HasColumnName(@"ShippedDate").IsOptional().HasColumnType("datetime");
@@ -2021,7 +2021,7 @@ public SummaryOfSalesByYearConfiguration()
20212021

20222022
public SummaryOfSalesByYearConfiguration(string schema)
20232023
{
2024-
ToTable(schema + ".Summary of Sales by Year");
2024+
ToTable("Summary of Sales by Year", schema);
20252025
HasKey(x => x.OrderId);
20262026

20272027
Property(x => x.ShippedDate).HasColumnName(@"ShippedDate").IsOptional().HasColumnType("datetime");
@@ -2041,7 +2041,7 @@ public SupplierConfiguration()
20412041

20422042
public SupplierConfiguration(string schema)
20432043
{
2044-
ToTable(schema + ".Suppliers");
2044+
ToTable("Suppliers", schema);
20452045
HasKey(x => x.SupplierId);
20462046

20472047
Property(x => x.SupplierId).HasColumnName(@"SupplierID").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
@@ -2070,7 +2070,7 @@ public SysdiagramConfiguration()
20702070

20712071
public SysdiagramConfiguration(string schema)
20722072
{
2073-
ToTable(schema + ".sysdiagrams");
2073+
ToTable("sysdiagrams", schema);
20742074
HasKey(x => x.DiagramId);
20752075

20762076
Property(x => x.Name).HasColumnName(@"name").IsRequired().HasColumnType("nvarchar").HasMaxLength(128);
@@ -2092,7 +2092,7 @@ public TerritoryConfiguration()
20922092

20932093
public TerritoryConfiguration(string schema)
20942094
{
2095-
ToTable(schema + ".Territories");
2095+
ToTable("Territories", schema);
20962096
HasKey(x => x.TerritoryId);
20972097

20982098
Property(x => x.TerritoryId).HasColumnName(@"TerritoryID").IsRequired().HasColumnType("nvarchar").HasMaxLength(20).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);

EntityFramework.Reverse.POCO.Generator/EF.Reverse.POCO.ttinclude

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ if(IncludeComments != CommentsStyle.None){#> // <#=tbl.Name#>
10021002
public <#=tbl.NameHumanCase + ConfigurationClassName#>(string schema)
10031003
{
10041004
<# if (!string.IsNullOrEmpty(tbl.Schema)) { #>
1005-
ToTable(schema + ".<#=tbl.Name#>");
1005+
ToTable("<#=tbl.Name#>", schema);
10061006
<# } else { #>
10071007
ToTable("<#=tbl.Name#>");
10081008
<# } #>

0 commit comments

Comments
 (0)