diff --git a/NuGet/linq2db.Access.nuspec b/NuGet/linq2db.Access.nuspec index 9ec6c63..2aae83b 100644 --- a/NuGet/linq2db.Access.nuspec +++ b/NuGet/linq2db.Access.nuspec @@ -2,7 +2,7 @@ linq2db.Access - 1.8.2 + 1.8.3 LINQ to Access Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db Access LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.DB2.nuspec b/NuGet/linq2db.DB2.nuspec index 1126415..74ee5b5 100644 --- a/NuGet/linq2db.DB2.nuspec +++ b/NuGet/linq2db.DB2.nuspec @@ -2,7 +2,7 @@ linq2db.DB2 - 1.8.2 + 1.8.3 LINQ to IBM DB2 Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db DB2 LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Firebird.nuspec b/NuGet/linq2db.Firebird.nuspec index 3888d42..7adbab5 100644 --- a/NuGet/linq2db.Firebird.nuspec +++ b/NuGet/linq2db.Firebird.nuspec @@ -2,7 +2,7 @@ linq2db.Firebird - 1.8.2 + 1.8.3 LINQ to Firebird Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db Firebird LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Informix.nuspec b/NuGet/linq2db.Informix.nuspec index 67cb30e..e3818b8 100644 --- a/NuGet/linq2db.Informix.nuspec +++ b/NuGet/linq2db.Informix.nuspec @@ -2,7 +2,7 @@ linq2db.Informix - 1.8.2 + 1.8.3 LINQ to Informix Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db Informix LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.MySql.nuspec b/NuGet/linq2db.MySql.nuspec index 876ccd9..5129551 100644 --- a/NuGet/linq2db.MySql.nuspec +++ b/NuGet/linq2db.MySql.nuspec @@ -2,7 +2,7 @@ linq2db.MySql - 1.8.2 + 1.8.3 LINQ to MySql Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db MySql LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Oracle.Managed.nuspec b/NuGet/linq2db.Oracle.Managed.nuspec index a42dd57..044603b 100644 --- a/NuGet/linq2db.Oracle.Managed.nuspec +++ b/NuGet/linq2db.Oracle.Managed.nuspec @@ -2,7 +2,7 @@ linq2db.Oracle.Managed - 1.8.2 + 1.8.3 LINQ to Oracle (ODP.NET) Managed Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db Oracle LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Oracle.x64.nuspec b/NuGet/linq2db.Oracle.x64.nuspec index 8291fd4..836aefc 100644 --- a/NuGet/linq2db.Oracle.x64.nuspec +++ b/NuGet/linq2db.Oracle.x64.nuspec @@ -2,7 +2,7 @@ linq2db.Oracle.x64 - 1.8.2 + 1.8.3 LINQ to Oracle (ODP.NET) x64 Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db Oracle ODP LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Oracle.x86.nuspec b/NuGet/linq2db.Oracle.x86.nuspec index f670d5f..4db48b0 100644 --- a/NuGet/linq2db.Oracle.x86.nuspec +++ b/NuGet/linq2db.Oracle.x86.nuspec @@ -2,7 +2,7 @@ linq2db.Oracle.x86 - 1.8.2 + 1.8.3 LINQ to Oracle (ODP.NET) x86 Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db Oracle ODP LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.PostgreSQL.nuspec b/NuGet/linq2db.PostgreSQL.nuspec index 20a6776..7b65b77 100644 --- a/NuGet/linq2db.PostgreSQL.nuspec +++ b/NuGet/linq2db.PostgreSQL.nuspec @@ -2,7 +2,7 @@ linq2db.PostgreSQL - 1.8.2 + 1.8.3 LINQ to PostgreSQL Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db Npgsql PostgreSQL LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.SQLite.nuspec b/NuGet/linq2db.SQLite.nuspec index 893a820..373f951 100644 --- a/NuGet/linq2db.SQLite.nuspec +++ b/NuGet/linq2db.SQLite.nuspec @@ -2,7 +2,7 @@ linq2db.SQLite - 1.8.2 + 1.8.3 LINQ to SQLite Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db SQLite LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.SapHana.nuspec b/NuGet/linq2db.SapHana.nuspec index e1dbda0..3299dcc 100644 --- a/NuGet/linq2db.SapHana.nuspec +++ b/NuGet/linq2db.SapHana.nuspec @@ -2,7 +2,7 @@ linq2db.SapHana - 1.8.2 + 1.8.3 LINQ to SAP HANA Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db SapHana LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.SqlCe.nuspec b/NuGet/linq2db.SqlCe.nuspec index d52c5ef..2850c3f 100644 --- a/NuGet/linq2db.SqlCe.nuspec +++ b/NuGet/linq2db.SqlCe.nuspec @@ -2,7 +2,7 @@ linq2db.SqlCe - 1.8.2 + 1.8.3 LINQ to SqlCe Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db SqlCe SqlServerCe SqlServer Compact LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.SqlServer.nuspec b/NuGet/linq2db.SqlServer.nuspec index cacfa16..0f1b52a 100644 --- a/NuGet/linq2db.SqlServer.nuspec +++ b/NuGet/linq2db.SqlServer.nuspec @@ -2,7 +2,7 @@ linq2db.SqlServer - 1.8.2 + 1.8.3 LINQ to SqlServer Igor Tkachev @@ -18,7 +18,7 @@ linq linq2db SqlServer LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.Sybase.nuspec b/NuGet/linq2db.Sybase.nuspec index 65c6784..f5f1a66 100644 --- a/NuGet/linq2db.Sybase.nuspec +++ b/NuGet/linq2db.Sybase.nuspec @@ -2,7 +2,7 @@ linq2db.Sybase - 1.8.2 + 1.8.3 LINQ to Sybase ASE Igor Tkachev @@ -19,7 +19,7 @@ linq linq2db Sybase LinqToDB ORM database DB SQL - + diff --git a/NuGet/linq2db.t4models.nuspec b/NuGet/linq2db.t4models.nuspec index df44c97..e55f615 100644 --- a/NuGet/linq2db.t4models.nuspec +++ b/NuGet/linq2db.t4models.nuspec @@ -2,7 +2,7 @@ linq2db.t4models - 1.8.2 + 1.8.3 LINQ to DB T4 Models Igor Tkachev @@ -23,17 +23,17 @@ - + - + - + diff --git a/README.md b/README.md index a920fd9..c569f97 100644 --- a/README.md +++ b/README.md @@ -88,13 +88,32 @@ GetSchemaOptions.ExcludedCatalogs = new[] { "TestUser", "SYSSTAT" }; // Defines GetSchemaOptions.IncludedCatalogs = new[] { "TestUser", "SYS" }; // Defines only included catalogs. ``` +## Provider specific configurations +### SQL Server +```cs +bool GenerateSqlServerFreeText = true; // Defines wheather to generate extensions for Free Text search, or not +``` +### PostgreSQL +```cs +bool GenerateCaseSensitiveNames = false; // Defines whether to generate case sensitive or insensitive names +``` +### Sybase +```cs +bool GenerateSybaseSystemTables = false; // Defines whether to generate Sybase sysobjects tables or not +``` + ## Customizing generation process Use the following code to modify your model **before** you call the `GenerateModel()` method. ```c# -GetTable("Person").TypeName = "MyName"; // Replaces table name. -GetColumn("Person", "PersonID").MemberName = "ID"; // Replaces column PersonID of Person table with ID. +GetTable("Person").TypeName = "MyName"; // Replaces table name. +GetTable("Person").BaseClass = "PersonBase, IId"; // Set base class & interface for type, null to reset + +GetColumn("Person", "PersonID") .MemberName = "ID"; // Replaces column PersonID of Person table with ID. +GetColumn("Person", "PasswordHash").SkipOnUpdate = true; // Set [Column(SkipOnUpdate=true)], same for other column options +GetColumn("Person", "Gender") .Type = "global::Model.Gender"; // Change column type + GetFK("Orders", "FK_Orders_Customers").MemberName = "Customers"; // Replaces association name. GetFK("Orders", "FK_Orders_Customers").AssociationType = AssociationType.OneToMany; // Changes association type. diff --git a/Templates/DataModel.ttinclude b/Templates/DataModel.ttinclude index d90fab4..4e43576 100644 --- a/Templates/DataModel.ttinclude +++ b/Templates/DataModel.ttinclude @@ -347,18 +347,41 @@ void LoadMetadata(DataConnection dataConnection) if (col.MemberName == t.TypeName) col.MemberName += "_Column"; } + + var duplicates = t.Columns.Values.ToLookup(c => c.MemberName).Where(g => g.Count() > 1); + foreach (var d in duplicates) + { + var alreadyNamed = new HashSet(); + foreach (var col in d) + { + col.MemberName = col.ColumnName; + if (keyWords.Contains(col.MemberName)) + col.MemberName = "@" + col.MemberName; + + col.MemberName = ConvertToCompilable(col.MemberName, false); + + if (col.MemberName == t.TypeName) + col.MemberName += "_Column"; + + while (alreadyNamed.Contains(col.MemberName)) + { + col.MemberName += "_"; + } + alreadyNamed.Add(col.MemberName); + } + } } AfterLoadMetadata(); } -string ConvertToCompilable(string name) +string ConvertToCompilable(string name, bool mayRemoveUnderscore = true) { var query = from c in name select char.IsLetterOrDigit(c) || c == '@' ? c : '_'; - return ToValidName(new string(query.ToArray())); + return ToValidName(new string(query.ToArray()), mayRemoveUnderscore); } Table GetTable(string name) @@ -638,9 +661,9 @@ public class Parameter } int _counter = 0; -string ToValidName(string name) +string ToValidName(string name, bool mayRemoveUnderscore = true) { - if (NormalizeNames && name.Contains("_")) + if (NormalizeNames && mayRemoveUnderscore && name.Contains("_")) { name = SplitAndJoin(name, "", '_'); } diff --git a/Templates/LinqToDB.PostgreSQL.ttinclude b/Templates/LinqToDB.PostgreSQL.ttinclude index 1c079da..8fdd3d5 100644 --- a/Templates/LinqToDB.PostgreSQL.ttinclude +++ b/Templates/LinqToDB.PostgreSQL.ttinclude @@ -13,7 +13,7 @@ } #><#+ -bool GenerateCaseSensitiveNames = false; +bool GenerateCaseSensitiveNames = false; // Defines whether to generate case sensitive or insensitive names void SetCaseSensitiveNames() { diff --git a/Templates/LinqToDB.SqlServer.ttinclude b/Templates/LinqToDB.SqlServer.ttinclude index 9e2f02a..74791db 100644 --- a/Templates/LinqToDB.SqlServer.ttinclude +++ b/Templates/LinqToDB.SqlServer.ttinclude @@ -5,18 +5,24 @@ AfterGenerateLinqToDBModel = () => { afterGenerateLinqToDBModel(); - GenerateSqlServerTypes(); + DoGenerateSqlServerFreeText(); }; } #> <#+ -void GenerateSqlServerTypes() +bool GenerateSqlServerFreeText = true; // Defines whether to generate extensions for Free Text search, or not + +void DoGenerateSqlServerFreeText() { + if (!GenerateSqlServerFreeText) + return; + Model.Usings.Add("System.Collections.Generic"); Model.Usings.Add("System.Linq.Expressions"); Model.Usings.Add("System.Reflection"); Model.Usings.Add("LinqToDB"); Model.Usings.Add("LinqToDB.DataProvider.SqlServer"); + Model.Usings.Add("LinqToDB.Extensions"); DataContextObject.Members.Add( new MemberGroup @@ -38,26 +44,46 @@ void GenerateSqlServerTypes() IsPartial = false }, + new Field("MethodInfo", "_freeTextTableMethod1") + { + AccessModifier = AccessModifier.Private, + IsStatic = true, + InitValue = "typeof(" + DataContextObject.Name + ").GetMethod(\"FreeTextTable\", new Type[] { typeof(string), typeof(string) })" + }, + new Method("ITable>", "FreeTextTable", new[] { "string field", "string text" }, new[] { "return this.GetTable>(", " this,", - " ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)),", + " _freeTextTableMethod1,", " field,", " text);", }) { Attributes = { new Attribute("FreeTextTableExpression") } }, + + new Field("MethodInfo", "_freeTextTableMethod2") + { + AccessModifier = AccessModifier.Private, + IsStatic = true, + InitValue = Environment.NewLine + + " typeof(" + DataContextObject.Name + ").GetMethods()" + Environment.NewLine + + " .Where(m => m.Name == \"FreeTextTable\" && m.IsGenericMethod && m.GetParameters().Length == 2)" + Environment.NewLine + + " .Where(m => m.GetParameters()[0].ParameterType.IsGenericTypeEx() && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>))" + Environment.NewLine + + " .Where(m => m.GetParameters()[1].ParameterType == typeof(string))" + Environment.NewLine + + " .Single()" + }, + new Method("ITable>", "FreeTextTable", new[] { "Expression> fieldSelector", "string text" }, new[] { "return this.GetTable>(", " this,", - " ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)),", + " _freeTextTableMethod2,", " fieldSelector,", " text);", }) diff --git a/Templates/LinqToDB.Sybase.ttinclude b/Templates/LinqToDB.Sybase.ttinclude index 80ca407..f1d2917 100644 --- a/Templates/LinqToDB.Sybase.ttinclude +++ b/Templates/LinqToDB.Sybase.ttinclude @@ -12,7 +12,7 @@ }; } #><#+ -bool GenerateSybaseSystemTables = false; +bool GenerateSybaseSystemTables = false; // Defines whether to generate Sybase sysobjects tables or not void GenerateSybaseTypes() { diff --git a/Tests/LinqToDB/Program.cs b/Tests/LinqToDB/Program.cs index d1199b9..40ffca5 100644 --- a/Tests/LinqToDB/Program.cs +++ b/Tests/LinqToDB/Program.cs @@ -13,7 +13,7 @@ static void Main(string[] args) var int1 = (int?)1; var str2 = "2"; - dc.Scalar_OutputParameter(ref int1, ref str2); + dc.ScalarOutputParameter(ref int1, ref str2); } } } diff --git a/Tests/LinqToDB/SqlServer.generated.cs b/Tests/LinqToDB/SqlServer.generated.cs index adb3d56..3aa82a0 100644 --- a/Tests/LinqToDB/SqlServer.generated.cs +++ b/Tests/LinqToDB/SqlServer.generated.cs @@ -15,6 +15,7 @@ using LinqToDB.Common; using LinqToDB.Data; using LinqToDB.DataProvider.SqlServer; +using LinqToDB.Extensions; using LinqToDB.Mapping; using Microsoft.SqlServer.Types; @@ -86,22 +87,31 @@ public class FreeTextKey public int Rank; } + private static MethodInfo _freeTextTableMethod1 = typeof(NorthwindDB).GetMethod("FreeTextTable", new Type[] { typeof(string), typeof(string) }); + [FreeTextTableExpression] public ITable> FreeTextTable(string field, string text) { return this.GetTable>( this, - ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)), + _freeTextTableMethod1, field, text); } + private static MethodInfo _freeTextTableMethod2 = + typeof(NorthwindDB).GetMethods() + .Where(m => m.Name == "FreeTextTable" && m.IsGenericMethod && m.GetParameters().Length == 2) + .Where(m => m.GetParameters()[0].ParameterType.IsGenericTypeEx() && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>)) + .Where(m => m.GetParameters()[1].ParameterType == typeof(string)) + .Single(); + [FreeTextTableExpression] public ITable> FreeTextTable(Expression> fieldSelector, string text) { return this.GetTable>( this, - ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)), + _freeTextTableMethod2, fieldSelector, text); } @@ -181,16 +191,16 @@ public partial class Customer #region Associations /// - /// FK_Orders_Customers_BackReference + /// FK_CustomerCustomerDemo_Customers_BackReference /// [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] - public List Orders { get; set; } + public List CustomerCustomerDemoes { get; set; } /// - /// FK_CustomerCustomerDemo_Customers_BackReference + /// FK_Orders_Customers_BackReference /// [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] - public List CustomerCustomerDemoes { get; set; } + public List Orders { get; set; } #endregion } @@ -222,7 +232,7 @@ public partial class CustomerCustomerDemo /// FK_CustomerCustomerDemo /// [Association(ThisKey="CustomerTypeID", OtherKey="CustomerTypeID", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="FK_CustomerCustomerDemo", BackReferenceName="CustomerCustomerDemoes")] - public CustomerDemographic FK_CustomerCustomerDemo { get; set; } + public CustomerDemographic CustomerDemographic { get; set; } #endregion } @@ -268,6 +278,12 @@ public partial class Employee #region Associations + /// + /// FK_EmployeeTerritories_Employees_BackReference + /// + [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] + public List EmployeeTerritories { get; set; } + /// /// FK_Employees_Employees /// @@ -286,12 +302,6 @@ public partial class Employee [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] public List Orders { get; set; } - /// - /// FK_EmployeeTerritories_Employees_BackReference - /// - [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] - public List EmployeeTerritories { get; set; } - #endregion } @@ -370,10 +380,10 @@ public partial class Order #region Associations /// - /// FK_Orders_Shippers + /// FK_Orders_Customers /// - [Association(ThisKey="ShipVia", OtherKey="ShipperID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Orders_Shippers", BackReferenceName="Orders")] - public Shipper Shipper { get; set; } + [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Orders_Customers", BackReferenceName="Orders")] + public Customer Customer { get; set; } /// /// FK_Orders_Employees @@ -381,18 +391,18 @@ public partial class Order [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Orders_Employees", BackReferenceName="Orders")] public Employee Employee { get; set; } - /// - /// FK_Orders_Customers - /// - [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Orders_Customers", BackReferenceName="Orders")] - public Customer Customer { get; set; } - /// /// FK_Order_Details_Orders_BackReference /// [Association(ThisKey="OrderID", OtherKey="ID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] public List OrderDetails { get; set; } + /// + /// FK_Orders_Shippers + /// + [Association(ThisKey="ShipVia", OtherKey="ShipperID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Orders_Shippers", BackReferenceName="Orders")] + public Shipper Shipper { get; set; } + #endregion } @@ -493,18 +503,18 @@ public partial class Product [Association(ThisKey="CategoryID", OtherKey="CategoryID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Products_Categories", BackReferenceName="Products")] public Category Category { get; set; } - /// - /// FK_Products_Suppliers - /// - [Association(ThisKey="SupplierID", OtherKey="SupplierID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Products_Suppliers", BackReferenceName="Products")] - public Supplier Supplier { get; set; } - /// /// FK_Order_Details_Products_BackReference /// [Association(ThisKey="ProductID", OtherKey="ProductID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] public List OrderDetails { get; set; } + /// + /// FK_Products_Suppliers + /// + [Association(ThisKey="SupplierID", OtherKey="SupplierID", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="FK_Products_Suppliers", BackReferenceName="Products")] + public Supplier Supplier { get; set; } + #endregion } @@ -647,18 +657,18 @@ public partial class Territory #region Associations - /// - /// FK_Territories_Region - /// - [Association(ThisKey="RegionID", OtherKey="RegionID", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="FK_Territories_Region", BackReferenceName="Territories")] - public Region Region { get; set; } - /// /// FK_EmployeeTerritories_Territories_BackReference /// [Association(ThisKey="TerritoryID", OtherKey="TerritoryID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] public List EmployeeTerritories { get; set; } + /// + /// FK_Territories_Region + /// + [Association(ThisKey="RegionID", OtherKey="RegionID", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="FK_Territories_Region", BackReferenceName="Territories")] + public Region Region { get; set; } + #endregion } @@ -881,32 +891,34 @@ public static Territory Find(this ITable table, string TerritoryID) /// public partial class TestDataDB : LinqToDB.Data.DataConnection { - public ITable AllTypes { get { return this.GetTable(); } } - public ITable AllTypes2 { get { return this.GetTable(); } } - public ITable BinaryData { get { return this.GetTable(); } } - public ITable Children { get { return this.GetTable(); } } - public ITable DataTypeTests { get { return this.GetTable(); } } - public ITable DecimalOverflows { get { return this.GetTable(); } } - public ITable Doctors { get { return this.GetTable(); } } - public ITable GrandChildren { get { return this.GetTable(); } } - public ITable GuidIDs { get { return this.GetTable(); } } - public ITable GuidID2 { get { return this.GetTable(); } } - public ITable IndexTables { get { return this.GetTable(); } } - public ITable IndexTable2 { get { return this.GetTable(); } } - public ITable LinqDataTypes { get { return this.GetTable(); } } - public ITable Name_Tests { get { return this.GetTable(); } } + public ITable AllTypes { get { return this.GetTable(); } } + public ITable AllTypes2 { get { return this.GetTable(); } } + public ITable BinaryData { get { return this.GetTable(); } } + public ITable Children { get { return this.GetTable(); } } + public ITable DataTypeTests { get { return this.GetTable(); } } + public ITable DecimalOverflows { get { return this.GetTable(); } } + public ITable Doctors { get { return this.GetTable(); } } + public ITable GrandChildren { get { return this.GetTable(); } } + public ITable GuidIDs { get { return this.GetTable(); } } + public ITable GuidID2 { get { return this.GetTable(); } } + public ITable IndexTables { get { return this.GetTable(); } } + public ITable IndexTable2 { get { return this.GetTable(); } } + public ITable InheritanceChildren { get { return this.GetTable(); } } + public ITable InheritanceParents { get { return this.GetTable(); } } + public ITable LinqDataTypes { get { return this.GetTable(); } } + public ITable NameTests { get { return this.GetTable(); } } /// /// This is Parent table /// - public ITable Parents { get { return this.GetTable(); } } - public ITable ParentChildViews { get { return this.GetTable(); } } - public ITable ParentViews { get { return this.GetTable(); } } - public ITable Patients { get { return this.GetTable(); } } - public ITable People { get { return this.GetTable(); } } - public ITable SqlTypes { get { return this.GetTable(); } } - public ITable TestIdentities { get { return this.GetTable(); } } - public ITable TestTable2 { get { return this.GetTable(); } } - public ITable TestTable3 { get { return this.GetTable(); } } + public ITable Parents { get { return this.GetTable(); } } + public ITable ParentChildViews { get { return this.GetTable(); } } + public ITable ParentViews { get { return this.GetTable(); } } + public ITable Patients { get { return this.GetTable(); } } + public ITable People { get { return this.GetTable(); } } + public ITable SqlTypes { get { return this.GetTable(); } } + public ITable TestIdentities { get { return this.GetTable(); } } + public ITable TestTable2 { get { return this.GetTable(); } } + public ITable TestTable3 { get { return this.GetTable(); } } public TestDataDB() { @@ -944,22 +956,31 @@ public class FreeTextKey public int Rank; } + private static MethodInfo _freeTextTableMethod1 = typeof(TestDataDB).GetMethod("FreeTextTable", new Type[] { typeof(string), typeof(string) }); + [FreeTextTableExpression] public ITable> FreeTextTable(string field, string text) { return this.GetTable>( this, - ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)), + _freeTextTableMethod1, field, text); } + private static MethodInfo _freeTextTableMethod2 = + typeof(TestDataDB).GetMethods() + .Where(m => m.Name == "FreeTextTable" && m.IsGenericMethod && m.GetParameters().Length == 2) + .Where(m => m.GetParameters()[0].ParameterType.IsGenericTypeEx() && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>)) + .Where(m => m.GetParameters()[1].ParameterType == typeof(string)) + .Single(); + [FreeTextTableExpression] public ITable> FreeTextTable(Expression> fieldSelector, string text) { return this.GetTable>( this, - ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)), + _freeTextTableMethod2, fieldSelector, text); } @@ -970,61 +991,62 @@ public ITable> FreeTextTable(Expression /// This ChildID column /// - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? ChildID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int _ID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? ChildID { get; set; } // int + [Column("_ID", DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int } [Table(Database="TestData", Name="DataTypeTest")] public partial class DataTypeTest { - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int DataTypeID { get; set; } // int - [Column(DbType="binary(50)", DataType=DataType.Binary, Length=50), Nullable ] public byte[] Binary_ { get; set; } // binary(50) - [Column(DbType="bit", DataType=DataType.Boolean), Nullable ] public bool? Boolean_ { get; set; } // bit - [Column(DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? Byte_ { get; set; } // tinyint - [Column(DbType="varbinary(50)", DataType=DataType.VarBinary, Length=50), Nullable ] public byte[] Bytes_ { get; set; } // varbinary(50) - [Column(DbType="char(1)", DataType=DataType.Char, Length=1), Nullable ] public char? Char_ { get; set; } // char(1) - [Column(DbType="datetime", DataType=DataType.DateTime), Nullable ] public DateTime? DateTime_ { get; set; } // datetime - [Column(DbType="decimal(20, 2)", DataType=DataType.Decimal, Precision=20, Scale=2), Nullable ] public decimal? Decimal_ { get; set; } // decimal(20, 2) - [Column(DbType="float", DataType=DataType.Double), Nullable ] public double? Double_ { get; set; } // float - [Column(DbType="uniqueidentifier", DataType=DataType.Guid), Nullable ] public Guid? Guid_ { get; set; } // uniqueidentifier - [Column(DbType="smallint", DataType=DataType.Int16), Nullable ] public short? Int16_ { get; set; } // smallint - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? Int32_ { get; set; } // int - [Column(DbType="bigint", DataType=DataType.Int64), Nullable ] public long? Int64_ { get; set; } // bigint - [Column(DbType="money", DataType=DataType.Money), Nullable ] public decimal? Money_ { get; set; } // money - [Column(DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? SByte_ { get; set; } // tinyint - [Column(DbType="real", DataType=DataType.Single), Nullable ] public float? Single_ { get; set; } // real - [Column(DbType="varbinary(50)", DataType=DataType.VarBinary, Length=50), Nullable ] public byte[] Stream_ { get; set; } // varbinary(50) - [Column(DbType="nvarchar(50)", DataType=DataType.NVarChar, Length=50), Nullable ] public string String_ { get; set; } // nvarchar(50) - [Column(DbType="smallint", DataType=DataType.Int16), Nullable ] public short? UInt16_ { get; set; } // smallint - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? UInt32_ { get; set; } // int - [Column(DbType="bigint", DataType=DataType.Int64), Nullable ] public long? UInt64_ { get; set; } // bigint - [Column(DbType="xml", DataType=DataType.Xml), Nullable ] public string Xml_ { get; set; } // xml + [Column( DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int DataTypeID { get; set; } // int + [Column("Binary_", DbType="binary(50)", DataType=DataType.Binary, Length=50), Nullable ] public byte[] Binary { get; set; } // binary(50) + [Column("Boolean_", DbType="bit", DataType=DataType.Boolean), Nullable ] public bool? Boolean { get; set; } // bit + [Column("Byte_", DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? Byte { get; set; } // tinyint + [Column("Bytes_", DbType="varbinary(50)", DataType=DataType.VarBinary, Length=50), Nullable ] public byte[] Bytes { get; set; } // varbinary(50) + [Column("Char_", DbType="char(1)", DataType=DataType.Char, Length=1), Nullable ] public char? Char { get; set; } // char(1) + [Column("DateTime_", DbType="datetime", DataType=DataType.DateTime), Nullable ] public DateTime? DateTime { get; set; } // datetime + [Column("Decimal_", DbType="decimal(20, 2)", DataType=DataType.Decimal, Precision=20, Scale=2), Nullable ] public decimal? Decimal { get; set; } // decimal(20, 2) + [Column("Double_", DbType="float", DataType=DataType.Double), Nullable ] public double? Double { get; set; } // float + [Column("Guid_", DbType="uniqueidentifier", DataType=DataType.Guid), Nullable ] public Guid? Guid { get; set; } // uniqueidentifier + [Column("Int16_", DbType="smallint", DataType=DataType.Int16), Nullable ] public short? Int16 { get; set; } // smallint + [Column("Int32_", DbType="int", DataType=DataType.Int32), Nullable ] public int? Int32 { get; set; } // int + [Column("Int64_", DbType="bigint", DataType=DataType.Int64), Nullable ] public long? Int64 { get; set; } // bigint + [Column("Money_", DbType="money", DataType=DataType.Money), Nullable ] public decimal? Money { get; set; } // money + [Column("SByte_", DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? SByte { get; set; } // tinyint + [Column("Single_", DbType="real", DataType=DataType.Single), Nullable ] public float? Single { get; set; } // real + [Column("Stream_", DbType="varbinary(50)", DataType=DataType.VarBinary, Length=50), Nullable ] public byte[] Stream { get; set; } // varbinary(50) + [Column("String_", DbType="nvarchar(50)", DataType=DataType.NVarChar, Length=50), Nullable ] public string String { get; set; } // nvarchar(50) + [Column("UInt16_", DbType="smallint", DataType=DataType.Int16), Nullable ] public short? UInt16 { get; set; } // smallint + [Column("UInt32_", DbType="int", DataType=DataType.Int32), Nullable ] public int? UInt32 { get; set; } // int + [Column("UInt64_", DbType="bigint", DataType=DataType.Int64), Nullable ] public long? UInt64 { get; set; } // bigint + [Column("Xml_", DbType="xml", DataType=DataType.Xml), Nullable ] public string Xml { get; set; } // xml } [Table(Database="TestData", Name="DecimalOverflow")] @@ -1103,10 +1125,10 @@ public partial class Doctor [Table(Database="TestData", Name="GrandChild")] public partial class GrandChild { - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? ChildID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? GrandChildID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int _ID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? ChildID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? GrandChildID { get; set; } // int + [Column("_ID", DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int } [Table(Database="TestData", Name="GuidID")] @@ -1136,7 +1158,7 @@ public partial class IndexTable /// FK_Patient2_IndexTable_BackReference /// [Association(ThisKey="PKField2, PKField1", OtherKey="PKField2, PKField1", CanBeNull=true, Relationship=Relationship.OneToOne, IsBackReference=true)] - public IndexTable2 Patient2 { get; set; } + public IndexTable2 Patient { get; set; } #endregion } @@ -1152,12 +1174,29 @@ public partial class IndexTable2 /// /// FK_Patient2_IndexTable /// - [Association(ThisKey="PKField2, PKField1", OtherKey="PKField2, PKField1", CanBeNull=false, Relationship=Relationship.OneToOne, KeyName="FK_Patient2_IndexTable", BackReferenceName="Patient2")] + [Association(ThisKey="PKField2, PKField1", OtherKey="PKField2, PKField1", CanBeNull=false, Relationship=Relationship.OneToOne, KeyName="FK_Patient2_IndexTable", BackReferenceName="Patient")] public IndexTable Patient2IndexTable { get; set; } #endregion } + [Table(Database="TestData", Name="InheritanceChild")] + public partial class InheritanceChild + { + [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, NotNull] public int InheritanceChildId { get; set; } // int + [Column(DbType="int", DataType=DataType.Int32), NotNull] public int InheritanceParentId { get; set; } // int + [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? TypeDiscriminator { get; set; } // int + [Column(DbType="nvarchar(50)", DataType=DataType.NVarChar, Length=50), Nullable ] public string Name { get; set; } // nvarchar(50) + } + + [Table(Database="TestData", Name="InheritanceParent")] + public partial class InheritanceParent + { + [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, NotNull] public int InheritanceParentId { get; set; } // int + [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? TypeDiscriminator { get; set; } // int + [Column(DbType="nvarchar(50)", DataType=DataType.NVarChar, Length=50), Nullable ] public string Name { get; set; } // nvarchar(50) + } + [Table(Database="TestData", Name="LinqDataTypes")] public partial class LinqDataType { @@ -1172,12 +1211,13 @@ public partial class LinqDataType [Column(DbType="smallint", DataType=DataType.Int16), Nullable ] public short? SmallIntValue { get; set; } // smallint [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? IntValue { get; set; } // int [Column(DbType="bigint", DataType=DataType.Int64), Nullable ] public long? BigIntValue { get; set; } // bigint + [Column(DbType="nvarchar(50)", DataType=DataType.NVarChar, Length=50), Nullable ] public string StringValue { get; set; } // nvarchar(50) } [Table(Database="TestData", Name="Name.Test")] - public partial class Name_Test + public partial class NameTest { - [Column("Name.Test", DbType="int", DataType=DataType.Int32), Nullable] public int? Name_Test_Column { get; set; } // int + [Column("Name.Test", DbType="int", DataType=DataType.Int32), Nullable] public int? NameTest_Column { get; set; } // int } /// @@ -1186,9 +1226,9 @@ public partial class Name_Test [Table(Database="TestData", Name="Parent")] public partial class Parent { - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? Value1 { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int _ID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? Value1 { get; set; } // int + [Column("_ID", DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int } [Table(Database="TestData", Name="ParentChildView", IsView=true)] @@ -1202,9 +1242,9 @@ public partial class ParentChildView [Table(Database="TestData", Name="ParentView", IsView=true)] public partial class ParentView { - [Column(DbType="int", DataType=DataType.Int32), Nullable] public int? ParentID { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), Nullable] public int? Value1 { get; set; } // int - [Column(DbType="int", DataType=DataType.Int32), Identity] public int _ID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable] public int? ParentID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable] public int? Value1 { get; set; } // int + [Column("_ID", DbType="int", DataType=DataType.Int32), Identity] public int ID { get; set; } // int } [Table(Database="TestData", Name="Patient")] @@ -1281,14 +1321,14 @@ public partial class TestTable3 public static partial class TestDataDBStoredProcedures { - #region Scalar_DataReader + #region ScalarDataReader - public static IEnumerable Scalar_DataReader(this DataConnection dataConnection) + public static IEnumerable ScalarDataReader(this DataConnection dataConnection) { - return dataConnection.QueryProc("[TestData]..[Scalar_DataReader]"); + return dataConnection.QueryProc("[TestData]..[Scalar_DataReader]"); } - public partial class Scalar_DataReaderResult + public partial class ScalarDataReaderResult { public int? intField { get; set; } public string stringField { get; set; } @@ -1296,9 +1336,9 @@ public partial class Scalar_DataReaderResult #endregion - #region Scalar_OutputParameter + #region ScalarOutputParameter - public static int Scalar_OutputParameter(this DataConnection dataConnection, ref int? @outputInt, ref string @outputString) + public static int ScalarOutputParameter(this DataConnection dataConnection, ref int? @outputInt, ref string @outputString) { var ret = dataConnection.ExecuteProc("[TestData]..[Scalar_OutputParameter]", new DataParameter("@outputInt", @outputInt, DataType.Int32) { Direction = ParameterDirection.InputOutput }, @@ -1312,9 +1352,9 @@ public static int Scalar_OutputParameter(this DataConnection dataConnection, ref #endregion - #region Scalar_ReturnParameterWithObject + #region ScalarReturnParameterWithObject - public static IEnumerable Scalar_ReturnParameterWithObject(this DataConnection dataConnection, int? @id) + public static IEnumerable ScalarReturnParameterWithObject(this DataConnection dataConnection, int? @id) { return dataConnection.QueryProc("[TestData]..[Scalar_ReturnParameterWithObject]", new DataParameter("@id", @id, DataType.Int32)); @@ -1322,9 +1362,9 @@ public static IEnumerable Scalar_ReturnParameterWithObject(this DataConn #endregion - #region Person_SelectByKey + #region PersonSelectByKey - public static IEnumerable Person_SelectByKey(this DataConnection dataConnection, int? @id) + public static IEnumerable PersonSelectByKey(this DataConnection dataConnection, int? @id) { return dataConnection.QueryProc("[TestData]..[Person_SelectByKey]", new DataParameter("@id", @id, DataType.Int32)); @@ -1332,18 +1372,18 @@ public static IEnumerable Person_SelectByKey(this DataConnection dataCon #endregion - #region Person_SelectAll + #region PersonSelectAll - public static IEnumerable Person_SelectAll(this DataConnection dataConnection) + public static IEnumerable PersonSelectAll(this DataConnection dataConnection) { return dataConnection.QueryProc("[TestData]..[Person_SelectAll]"); } #endregion - #region Person_SelectByName + #region PersonSelectByName - public static IEnumerable Person_SelectByName(this DataConnection dataConnection, string @firstName, string @lastName) + public static IEnumerable PersonSelectByName(this DataConnection dataConnection, string @firstName, string @lastName) { return dataConnection.QueryProc("[TestData]..[Person_SelectByName]", new DataParameter("@firstName", @firstName, DataType.NVarChar), @@ -1352,9 +1392,9 @@ public static IEnumerable Person_SelectByName(this DataConnection dataCo #endregion - #region Person_SelectListByName + #region PersonSelectListByName - public static IEnumerable Person_SelectListByName(this DataConnection dataConnection, string @firstName, string @lastName) + public static IEnumerable PersonSelectListByName(this DataConnection dataConnection, string @firstName, string @lastName) { return dataConnection.QueryProc("[TestData]..[Person_SelectListByName]", new DataParameter("@firstName", @firstName, DataType.NVarChar), @@ -1363,27 +1403,27 @@ public static IEnumerable Person_SelectListByName(this DataConnection da #endregion - #region Person_Insert + #region PersonInsert - public static IEnumerable Person_Insert(this DataConnection dataConnection, string @FirstName, string @LastName, string @MiddleName, char? @Gender) + public static IEnumerable PersonInsert(this DataConnection dataConnection, string @FirstName, string @LastName, string @MiddleName, char? @Gender) { - return dataConnection.QueryProc("[TestData]..[Person_Insert]", + return dataConnection.QueryProc("[TestData]..[Person_Insert]", new DataParameter("@FirstName", @FirstName, DataType.NVarChar), new DataParameter("@LastName", @LastName, DataType.NVarChar), new DataParameter("@MiddleName", @MiddleName, DataType.NVarChar), new DataParameter("@Gender", @Gender, DataType.Char)); } - public partial class Person_InsertResult + public partial class PersonInsertResult { public int? PersonID { get; set; } } #endregion - #region Person_Insert_OutputParameter + #region PersonInsertOutputParameter - public static int Person_Insert_OutputParameter(this DataConnection dataConnection, string @FirstName, string @LastName, string @MiddleName, char? @Gender, ref int? @PersonID) + public static int PersonInsertOutputParameter(this DataConnection dataConnection, string @FirstName, string @LastName, string @MiddleName, char? @Gender, ref int? @PersonID) { var ret = dataConnection.ExecuteProc("[TestData]..[Person_Insert_OutputParameter]", new DataParameter("@FirstName", @FirstName, DataType.NVarChar), @@ -1399,9 +1439,9 @@ public static int Person_Insert_OutputParameter(this DataConnection dataConnecti #endregion - #region Person_Update + #region PersonUpdate - public static int Person_Update(this DataConnection dataConnection, int? @PersonID, string @FirstName, string @LastName, string @MiddleName, char? @Gender) + public static int PersonUpdate(this DataConnection dataConnection, int? @PersonID, string @FirstName, string @LastName, string @MiddleName, char? @Gender) { return dataConnection.ExecuteProc("[TestData]..[Person_Update]", new DataParameter("@PersonID", @PersonID, DataType.Int32), @@ -1413,9 +1453,9 @@ public static int Person_Update(this DataConnection dataConnection, int? @Person #endregion - #region Person_Delete + #region PersonDelete - public static int Person_Delete(this DataConnection dataConnection, int? @PersonID) + public static int PersonDelete(this DataConnection dataConnection, int? @PersonID) { return dataConnection.ExecuteProc("[TestData]..[Person_Delete]", new DataParameter("@PersonID", @PersonID, DataType.Int32)); @@ -1423,14 +1463,14 @@ public static int Person_Delete(this DataConnection dataConnection, int? @Person #endregion - #region Patient_SelectAll + #region PatientSelectAll - public static IEnumerable Patient_SelectAll(this DataConnection dataConnection) + public static IEnumerable PatientSelectAll(this DataConnection dataConnection) { - return dataConnection.QueryProc("[TestData]..[Patient_SelectAll]"); + return dataConnection.QueryProc("[TestData]..[Patient_SelectAll]"); } - public partial class Patient_SelectAllResult + public partial class PatientSelectAllResult { public int PersonID { get; set; } public string FirstName { get; set; } @@ -1442,16 +1482,16 @@ public partial class Patient_SelectAllResult #endregion - #region Patient_SelectByName + #region PatientSelectByName - public static IEnumerable Patient_SelectByName(this DataConnection dataConnection, string @firstName, string @lastName) + public static IEnumerable PatientSelectByName(this DataConnection dataConnection, string @firstName, string @lastName) { - return dataConnection.QueryProc("[TestData]..[Patient_SelectByName]", + return dataConnection.QueryProc("[TestData]..[Patient_SelectByName]", new DataParameter("@firstName", @firstName, DataType.NVarChar), new DataParameter("@lastName", @lastName, DataType.NVarChar)); } - public partial class Patient_SelectByNameResult + public partial class PatientSelectByNameResult { public int PersonID { get; set; } public string FirstName { get; set; } @@ -1549,10 +1589,10 @@ public partial class DuplicateColumnNamesResult public static partial class SqlFunctions { - #region Scalar_ReturnParameter + #region ScalarReturnParameter [Sql.Function(Name=".Scalar_ReturnParameter", ServerSideOnly=true)] - public static int? Scalar_ReturnParameter() + public static int? ScalarReturnParameter() { throw new InvalidOperationException(); } @@ -1580,10 +1620,10 @@ public static BinaryData Find(this ITable table, int BinaryDataID) t.BinaryDataID == BinaryDataID); } - public static Child Find(this ITable table, int _ID) + public static Child Find(this ITable table, int ID) { return table.FirstOrDefault(t => - t._ID == _ID); + t.ID == ID); } public static DataTypeTest Find(this ITable table, int DataTypeID) @@ -1604,10 +1644,10 @@ public static Doctor Find(this ITable table, int PersonID) t.PersonID == PersonID); } - public static GrandChild Find(this ITable table, int _ID) + public static GrandChild Find(this ITable table, int ID) { return table.FirstOrDefault(t => - t._ID == _ID); + t.ID == ID); } public static GuidID Find(this ITable table, Guid ID) @@ -1636,16 +1676,28 @@ public static IndexTable2 Find(this ITable table, int PKField1, int t.PKField2 == PKField2); } + public static InheritanceChild Find(this ITable table, int InheritanceChildId) + { + return table.FirstOrDefault(t => + t.InheritanceChildId == InheritanceChildId); + } + + public static InheritanceParent Find(this ITable table, int InheritanceParentId) + { + return table.FirstOrDefault(t => + t.InheritanceParentId == InheritanceParentId); + } + public static LinqDataType Find(this ITable table, int _ID) { return table.FirstOrDefault(t => t._ID == _ID); } - public static Parent Find(this ITable table, int _ID) + public static Parent Find(this ITable table, int ID) { return table.FirstOrDefault(t => - t._ID == _ID); + t.ID == ID); } public static Patient Find(this ITable table, int PersonID) diff --git a/Tests/LinqToDB/SqlServer.tt b/Tests/LinqToDB/SqlServer.tt index c30639c..3261342 100644 --- a/Tests/LinqToDB/SqlServer.tt +++ b/Tests/LinqToDB/SqlServer.tt @@ -1,10 +1,10 @@ -<#@ template language="C#" debug="True" hostSpecific="True" #> -<#@ output extension=".generated.cs" #> -<#@ include file="..\..\Templates\LinqToDB.SqlServer.ttinclude" #> -<#@ include file="..\..\Templates\PluralizationService.ttinclude" #> -<#@ include file="..\..\Templates\ObsoleteAttributes.ttinclude" #> -<#@ assembly name="$(SolutionDir)\packages\Microsoft.SqlServer.Types.11.0.2\lib\Net20\Microsoft.SqlServer.Types.dll" #> -<#@ assembly name="$(SolutionDir)\packages\linq2db.1.7.5\lib\net40\linq2db.dll" #> +<#@ template language="C#" debug="True" hostSpecific="True" #> +<#@ output extension=".generated.cs" #> +<#@ include file="..\..\Templates\LinqToDB.SqlServer.ttinclude" #> +<#@ include file="..\..\Templates\PluralizationService.ttinclude" #> +<#@ include file="..\..\Templates\ObsoleteAttributes.ttinclude" #> +<#@ assembly name="$(SolutionDir)\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll" #> +<#@ assembly name="$(SolutionDir)\packages\linq2db.1.8.2\lib\net40\linq2db.dll" #> <# // NamespaceName = "DataContext"; // DataContextName = "NorthwindDB"; diff --git a/Tests/LinqToDB/T4Model.LinqToDB.csproj b/Tests/LinqToDB/T4Model.LinqToDB.csproj index 6b79c7a..5632123 100644 --- a/Tests/LinqToDB/T4Model.LinqToDB.csproj +++ b/Tests/LinqToDB/T4Model.LinqToDB.csproj @@ -41,11 +41,12 @@ ..\..\packages\FirebirdSql.Data.FirebirdClient.5.6.0\lib\net45\FirebirdSql.Data.FirebirdClient.dll True - - ..\..\packages\linq2db.1.8.2\lib\net45\linq2db.dll + + ..\..\packages\linq2db.1.8.3\lib\net45\linq2db.dll - ..\..\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll + ..\..\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\Net40\Microsoft.SqlServer.Types.dll + True ..\..\packages\Npgsql.2.2.6\lib\net45\Mono.Security.dll @@ -205,19 +206,23 @@ - - + + SqlServerTypes\x64\msvcr100.dll PreserveNewest - + + SqlServerTypes\x64\SqlServerSpatial110.dll PreserveNewest - + + SqlServerTypes\x86\msvcr100.dll PreserveNewest - + + SqlServerTypes\x86\SqlServerSpatial110.dll PreserveNewest + diff --git a/Tests/LinqToDB/packages.config b/Tests/LinqToDB/packages.config index 4e61e18..64b80f7 100644 --- a/Tests/LinqToDB/packages.config +++ b/Tests/LinqToDB/packages.config @@ -1,7 +1,7 @@  - + diff --git a/appveyor.yml b/appveyor.yml index eb5f071..8593a56 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ configuration: Release environment: - packageVersion: 1.8.2 - linq2dbVersion: 1.8.2 + packageVersion: 1.8.3 + linq2dbVersion: 1.8.3 version: $(packageVersion).{build} diff --git a/packages/linq2db.1.8.2/lib/net40/linq2db.dll b/packages/linq2db.1.8.2/lib/net40/linq2db.dll deleted file mode 100644 index d23c004..0000000 Binary files a/packages/linq2db.1.8.2/lib/net40/linq2db.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/net40/linq2db.pdb b/packages/linq2db.1.8.2/lib/net40/linq2db.pdb deleted file mode 100644 index d94bd0b..0000000 Binary files a/packages/linq2db.1.8.2/lib/net40/linq2db.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/net45/linq2db.dll b/packages/linq2db.1.8.2/lib/net45/linq2db.dll deleted file mode 100644 index ecef9ff..0000000 Binary files a/packages/linq2db.1.8.2/lib/net45/linq2db.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/net45/linq2db.pdb b/packages/linq2db.1.8.2/lib/net45/linq2db.pdb deleted file mode 100644 index 91ab88e..0000000 Binary files a/packages/linq2db.1.8.2/lib/net45/linq2db.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.dll b/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.dll deleted file mode 100644 index 5632529..0000000 Binary files a/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.pdb b/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.pdb deleted file mode 100644 index b3ad1bf..0000000 Binary files a/packages/linq2db.1.8.2/lib/netcore45/linq2db.WindowsStore.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.dll b/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.dll deleted file mode 100644 index 2f2119f..0000000 Binary files a/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.pdb b/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.pdb deleted file mode 100644 index 35c55cd..0000000 Binary files a/packages/linq2db.1.8.2/lib/sl4/linq2db.Silverlight.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.dll b/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.dll deleted file mode 100644 index 7dd1855..0000000 Binary files a/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.pdb b/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.pdb deleted file mode 100644 index 198e0be..0000000 Binary files a/packages/linq2db.1.8.2/lib/sl5/linq2db.Silverlight.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.dll b/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.dll deleted file mode 100644 index 5632529..0000000 Binary files a/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.dll and /dev/null differ diff --git a/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.pdb b/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.pdb deleted file mode 100644 index b3ad1bf..0000000 Binary files a/packages/linq2db.1.8.2/lib/windows8/linq2db.WindowsStore.pdb and /dev/null differ diff --git a/packages/linq2db.1.8.2/linq2db.1.8.2.nupkg b/packages/linq2db.1.8.2/linq2db.1.8.2.nupkg deleted file mode 100644 index ea0e18f..0000000 Binary files a/packages/linq2db.1.8.2/linq2db.1.8.2.nupkg and /dev/null differ diff --git a/packages/linq2db.1.8.2/Readme.txt b/packages/linq2db.1.8.3/Readme.txt similarity index 76% rename from packages/linq2db.1.8.2/Readme.txt rename to packages/linq2db.1.8.3/Readme.txt index 42493ae..4ec64b5 100644 --- a/packages/linq2db.1.8.2/Readme.txt +++ b/packages/linq2db.1.8.3/Readme.txt @@ -1,6 +1,23 @@ +LINQ to DB 1.8.3 Release Notes +--------------------------------- +[!] Fixed problems with Configuration.Linq.UseBinaryAggregateExpression (#708, #716) +[!] Experimental support for query retry (#736, https://github.com/linq2db/linq2db/blob/master/Tests/Linq/Data/RetryPolicyTest.cs) + +Better support for NpgSql 3.2.3 (#714, #715) +Fixed issue with wrong convert optimization (#722) +Fixed join optimization (#728) +Fixed nullable enum mapping edge cases (#726) +Fixed issue with cached query (#737, #738) +Update with OrderBy support (#205, #729) +Changed string trimming for fixed size string columns (trim only spaces) (#727) +Better support for creating tables with Oracle (#731, #750, #723, #724) +Fixed InsertOrUpdate to work as InsertIfNotExists when update fields not specified (all providers) (#100, #732, #746) + + LINQ to DB 1.8.2 Release Notes --------------------------------- -Configuration.Linq.UseBinaryAggregateExpression is set to false by default as supposed to be unstable +[!] Configuration.Linq.UseBinaryAggregateExpression is set to false by default as supposed to be unstable + LINQ to DB 1.8.1 Release Notes --------------------------------- diff --git a/packages/linq2db.1.8.3/lib/net40/linq2db.dll b/packages/linq2db.1.8.3/lib/net40/linq2db.dll new file mode 100644 index 0000000..d80c0ac Binary files /dev/null and b/packages/linq2db.1.8.3/lib/net40/linq2db.dll differ diff --git a/packages/linq2db.1.8.3/lib/net40/linq2db.pdb b/packages/linq2db.1.8.3/lib/net40/linq2db.pdb new file mode 100644 index 0000000..a6362a4 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/net40/linq2db.pdb differ diff --git a/packages/linq2db.1.8.3/lib/net45/linq2db.dll b/packages/linq2db.1.8.3/lib/net45/linq2db.dll new file mode 100644 index 0000000..1039478 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/net45/linq2db.dll differ diff --git a/packages/linq2db.1.8.3/lib/net45/linq2db.pdb b/packages/linq2db.1.8.3/lib/net45/linq2db.pdb new file mode 100644 index 0000000..e531c4b Binary files /dev/null and b/packages/linq2db.1.8.3/lib/net45/linq2db.pdb differ diff --git a/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.dll b/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.dll new file mode 100644 index 0000000..1a8f2c0 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.dll differ diff --git a/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.pdb b/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.pdb new file mode 100644 index 0000000..dc56b18 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/netcore45/linq2db.WindowsStore.pdb differ diff --git a/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.dll b/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.dll new file mode 100644 index 0000000..cef1a66 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.dll differ diff --git a/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.pdb b/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.pdb new file mode 100644 index 0000000..0f0520c Binary files /dev/null and b/packages/linq2db.1.8.3/lib/sl4/linq2db.Silverlight.pdb differ diff --git a/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.dll b/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.dll new file mode 100644 index 0000000..0ced345 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.dll differ diff --git a/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.pdb b/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.pdb new file mode 100644 index 0000000..1a8c618 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/sl5/linq2db.Silverlight.pdb differ diff --git a/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.dll b/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.dll new file mode 100644 index 0000000..1a8f2c0 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.dll differ diff --git a/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.pdb b/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.pdb new file mode 100644 index 0000000..dc56b18 Binary files /dev/null and b/packages/linq2db.1.8.3/lib/windows8/linq2db.WindowsStore.pdb differ diff --git a/packages/linq2db.1.8.3/linq2db.1.8.3.nupkg b/packages/linq2db.1.8.3/linq2db.1.8.3.nupkg new file mode 100644 index 0000000..41f4751 Binary files /dev/null and b/packages/linq2db.1.8.3/linq2db.1.8.3.nupkg differ