From 8c633cff5859b92afbcb063a863b585f49934c47 Mon Sep 17 00:00:00 2001 From: Igor Tkachev Date: Fri, 30 Jun 2017 14:11:28 -0400 Subject: [PATCH] Fixed test template. --- Templates/LinqToDB.SqlServer.ttinclude | 2 +- Tests/LinqToDB/SqlServer.generated.cs | 436 ++++++++++++++----------- Tests/LinqToDB/SqlServer.tt | 14 +- Tests/LinqToDB/T4Model.LinqToDB.csproj | 34 +- 4 files changed, 272 insertions(+), 214 deletions(-) diff --git a/Templates/LinqToDB.SqlServer.ttinclude b/Templates/LinqToDB.SqlServer.ttinclude index 1df8b34..74791db 100644 --- a/Templates/LinqToDB.SqlServer.ttinclude +++ b/Templates/LinqToDB.SqlServer.ttinclude @@ -71,7 +71,7 @@ void DoGenerateSqlServerFreeText() 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.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()" 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; using LinqToDB.Common; using LinqToDB.Data; using LinqToDB.DataProvider.SqlServer; +using LinqToDB.Extensions; using LinqToDB.Mapping; using Microsoft.SqlServer.Types; @@ -86,22 +87,31 @@ namespace DataModel 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); } @@ -180,18 +190,18 @@ namespace DataModel #region Associations - /// - /// FK_Orders_Customers_BackReference - /// - [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] - public List Orders { get; set; } - /// /// FK_CustomerCustomerDemo_Customers_BackReference /// [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] public List CustomerCustomerDemoes { get; set; } + /// + /// FK_Orders_Customers_BackReference + /// + [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)] + public List Orders { get; set; } + #endregion } @@ -222,7 +232,7 @@ namespace DataModel /// 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 @@ namespace DataModel #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 @@ namespace DataModel [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 @@ namespace DataModel #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 @@ namespace DataModel [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 @@ namespace DataModel [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 @@ namespace DataModel #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 @@ namespace DataModel /// 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 @@ namespace DataModel 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 @@ namespace DataModel [Table(Database="TestData", Name="AllTypes")] public partial class AllType { - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int - [Column(DbType="bigint", DataType=DataType.Int64), Nullable ] public long? bigintDataType { get; set; } // bigint - [Column(DbType="numeric(18, 1)", DataType=DataType.Decimal, Precision=18, Scale=1), Nullable ] public decimal? numericDataType { get; set; } // numeric(18, 1) - [Column(DbType="bit", DataType=DataType.Boolean), Nullable ] public bool? bitDataType { get; set; } // bit - [Column(DbType="smallint", DataType=DataType.Int16), Nullable ] public short? smallintDataType { get; set; } // smallint - [Column(DbType="decimal(18, 1)", DataType=DataType.Decimal, Precision=18, Scale=1), Nullable ] public decimal? decimalDataType { get; set; } // decimal(18, 1) - [Column(DbType="smallmoney", DataType=DataType.SmallMoney), Nullable ] public decimal? smallmoneyDataType { get; set; } // smallmoney - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? intDataType { get; set; } // int - [Column(DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? tinyintDataType { get; set; } // tinyint - [Column(DbType="money", DataType=DataType.Money), Nullable ] public decimal? moneyDataType { get; set; } // money - [Column(DbType="float", DataType=DataType.Double), Nullable ] public double? floatDataType { get; set; } // float - [Column(DbType="real", DataType=DataType.Single), Nullable ] public float? realDataType { get; set; } // real - [Column(DbType="datetime", DataType=DataType.DateTime), Nullable ] public DateTime? datetimeDataType { get; set; } // datetime - [Column(DbType="smalldatetime", DataType=DataType.SmallDateTime), Nullable ] public DateTime? smalldatetimeDataType { get; set; } // smalldatetime - [Column(DbType="char(1)", DataType=DataType.Char, Length=1), Nullable ] public char? charDataType { get; set; } // char(1) - [Column(DbType="varchar(20)", DataType=DataType.VarChar, Length=20), Nullable ] public string varcharDataType { get; set; } // varchar(20) - [Column(DbType="text", DataType=DataType.Text), Nullable ] public string textDataType { get; set; } // text - [Column(DbType="nchar(20)", DataType=DataType.NChar, Length=20), Nullable ] public string ncharDataType { get; set; } // nchar(20) - [Column(DbType="nvarchar(20)", DataType=DataType.NVarChar, Length=20), Nullable ] public string nvarcharDataType { get; set; } // nvarchar(20) - [Column(DbType="ntext", DataType=DataType.NText), Nullable ] public string ntextDataType { get; set; } // ntext - [Column(DbType="binary(1)", DataType=DataType.Binary, Length=1), Nullable ] public byte[] binaryDataType { get; set; } // binary(1) - [Column(DbType="varbinary(1)", DataType=DataType.VarBinary, Length=1), Nullable ] public byte[] varbinaryDataType { get; set; } // varbinary(1) - [Column(DbType="image", DataType=DataType.Image), Nullable ] public byte[] imageDataType { get; set; } // image - [Column(DbType="timestamp", DataType=DataType.Timestamp, SkipOnInsert=true, SkipOnUpdate=true), Nullable ] public byte[] timestampDataType { get; set; } // timestamp - [Column(DbType="uniqueidentifier", DataType=DataType.Guid), Nullable ] public Guid? uniqueidentifierDataType { get; set; } // uniqueidentifier - [Column(DbType="sql_variant", DataType=DataType.Variant), Nullable ] public object sql_variantDataType { get; set; } // sql_variant - [Column(DbType="nvarchar(max)", DataType=DataType.NVarChar, Length=int.MaxValue), Nullable ] public string nvarchar_max_DataType { get; set; } // nvarchar(max) - [Column(DbType="varchar(max)", DataType=DataType.VarChar, Length=int.MaxValue), Nullable ] public string varchar_max_DataType { get; set; } // varchar(max) - [Column(DbType="varbinary(max)", DataType=DataType.VarBinary, Length=int.MaxValue), Nullable ] public byte[] varbinary_max_DataType { get; set; } // varbinary(max) - [Column(DbType="xml", DataType=DataType.Xml), Nullable ] public string xmlDataType { get; set; } // xml - [Column(DbType="datetime2(7)", DataType=DataType.DateTime2, Precision=7), Nullable ] public DateTime? datetime2DataType { get; set; } // datetime2(7) - [Column(DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? datetimeoffsetDataType { get; set; } // datetimeoffset(7) - [Column(DbType="datetimeoffset(0)", DataType=DataType.DateTimeOffset, Precision=0), Nullable ] public DateTimeOffset? datetimeoffset0DataType { get; set; } // datetimeoffset(0) - [Column(DbType="datetimeoffset(1)", DataType=DataType.DateTimeOffset, Precision=1), Nullable ] public DateTimeOffset? datetimeoffset1DataType { get; set; } // datetimeoffset(1) - [Column(DbType="datetimeoffset(2)", DataType=DataType.DateTimeOffset, Precision=2), Nullable ] public DateTimeOffset? datetimeoffset2DataType { get; set; } // datetimeoffset(2) - [Column(DbType="datetimeoffset(3)", DataType=DataType.DateTimeOffset, Precision=3), Nullable ] public DateTimeOffset? datetimeoffset3DataType { get; set; } // datetimeoffset(3) - [Column(DbType="datetimeoffset(4)", DataType=DataType.DateTimeOffset, Precision=4), Nullable ] public DateTimeOffset? datetimeoffset4DataType { get; set; } // datetimeoffset(4) - [Column(DbType="datetimeoffset(5)", DataType=DataType.DateTimeOffset, Precision=5), Nullable ] public DateTimeOffset? datetimeoffset5DataType { get; set; } // datetimeoffset(5) - [Column(DbType="datetimeoffset(6)", DataType=DataType.DateTimeOffset, Precision=6), Nullable ] public DateTimeOffset? datetimeoffset6DataType { get; set; } // datetimeoffset(6) - [Column(DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? datetimeoffset7DataType { get; set; } // datetimeoffset(7) - [Column(DbType="date", DataType=DataType.Date), Nullable ] public DateTime? dateDataType { get; set; } // date - [Column(DbType="time(7)", DataType=DataType.Time, Precision=7), Nullable ] public TimeSpan? timeDataType { get; set; } // time(7) + [Column( DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int + [Column("bigintDataType", DbType="bigint", DataType=DataType.Int64), Nullable ] public long? BigintDataType { get; set; } // bigint + [Column("numericDataType", DbType="numeric(18, 1)", DataType=DataType.Decimal, Precision=18, Scale=1), Nullable ] public decimal? NumericDataType { get; set; } // numeric(18, 1) + [Column("bitDataType", DbType="bit", DataType=DataType.Boolean), Nullable ] public bool? BitDataType { get; set; } // bit + [Column("smallintDataType", DbType="smallint", DataType=DataType.Int16), Nullable ] public short? SmallintDataType { get; set; } // smallint + [Column("decimalDataType", DbType="decimal(18, 1)", DataType=DataType.Decimal, Precision=18, Scale=1), Nullable ] public decimal? DecimalDataType { get; set; } // decimal(18, 1) + [Column("smallmoneyDataType", DbType="smallmoney", DataType=DataType.SmallMoney), Nullable ] public decimal? SmallmoneyDataType { get; set; } // smallmoney + [Column("intDataType", DbType="int", DataType=DataType.Int32), Nullable ] public int? IntDataType { get; set; } // int + [Column("tinyintDataType", DbType="tinyint", DataType=DataType.Byte), Nullable ] public byte? TinyintDataType { get; set; } // tinyint + [Column("moneyDataType", DbType="money", DataType=DataType.Money), Nullable ] public decimal? MoneyDataType { get; set; } // money + [Column("floatDataType", DbType="float", DataType=DataType.Double), Nullable ] public double? FloatDataType { get; set; } // float + [Column("realDataType", DbType="real", DataType=DataType.Single), Nullable ] public float? RealDataType { get; set; } // real + [Column("datetimeDataType", DbType="datetime", DataType=DataType.DateTime), Nullable ] public DateTime? DatetimeDataType { get; set; } // datetime + [Column("smalldatetimeDataType", DbType="smalldatetime", DataType=DataType.SmallDateTime), Nullable ] public DateTime? SmalldatetimeDataType { get; set; } // smalldatetime + [Column("charDataType", DbType="char(1)", DataType=DataType.Char, Length=1), Nullable ] public char? CharDataType { get; set; } // char(1) + [Column("char20DataType", DbType="char(20)", DataType=DataType.Char, Length=20), Nullable ] public string Char20DataType { get; set; } // char(20) + [Column("varcharDataType", DbType="varchar(20)", DataType=DataType.VarChar, Length=20), Nullable ] public string VarcharDataType { get; set; } // varchar(20) + [Column("textDataType", DbType="text", DataType=DataType.Text), Nullable ] public string TextDataType { get; set; } // text + [Column("ncharDataType", DbType="nchar(20)", DataType=DataType.NChar, Length=20), Nullable ] public string NcharDataType { get; set; } // nchar(20) + [Column("nvarcharDataType", DbType="nvarchar(20)", DataType=DataType.NVarChar, Length=20), Nullable ] public string NvarcharDataType { get; set; } // nvarchar(20) + [Column("ntextDataType", DbType="ntext", DataType=DataType.NText), Nullable ] public string NtextDataType { get; set; } // ntext + [Column("binaryDataType", DbType="binary(1)", DataType=DataType.Binary, Length=1), Nullable ] public byte[] BinaryDataType { get; set; } // binary(1) + [Column("varbinaryDataType", DbType="varbinary(1)", DataType=DataType.VarBinary, Length=1), Nullable ] public byte[] VarbinaryDataType { get; set; } // varbinary(1) + [Column("imageDataType", DbType="image", DataType=DataType.Image), Nullable ] public byte[] ImageDataType { get; set; } // image + [Column("timestampDataType", DbType="timestamp", DataType=DataType.Timestamp, SkipOnInsert=true, SkipOnUpdate=true), Nullable ] public byte[] TimestampDataType { get; set; } // timestamp + [Column("uniqueidentifierDataType", DbType="uniqueidentifier", DataType=DataType.Guid), Nullable ] public Guid? UniqueidentifierDataType { get; set; } // uniqueidentifier + [Column("sql_variantDataType", DbType="sql_variant", DataType=DataType.Variant), Nullable ] public object SqlVariantDataType { get; set; } // sql_variant + [Column("nvarchar_max_DataType", DbType="nvarchar(max)", DataType=DataType.NVarChar, Length=int.MaxValue), Nullable ] public string NvarcharMaxDataType { get; set; } // nvarchar(max) + [Column("varchar_max_DataType", DbType="varchar(max)", DataType=DataType.VarChar, Length=int.MaxValue), Nullable ] public string VarcharMaxDataType { get; set; } // varchar(max) + [Column("varbinary_max_DataType", DbType="varbinary(max)", DataType=DataType.VarBinary, Length=int.MaxValue), Nullable ] public byte[] VarbinaryMaxDataType { get; set; } // varbinary(max) + [Column("xmlDataType", DbType="xml", DataType=DataType.Xml), Nullable ] public string XmlDataType { get; set; } // xml + [Column("datetime2DataType", DbType="datetime2(7)", DataType=DataType.DateTime2, Precision=7), Nullable ] public DateTime? Datetime2DataType { get; set; } // datetime2(7) + [Column("datetimeoffsetDataType", DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? DatetimeoffsetDataType { get; set; } // datetimeoffset(7) + [Column("datetimeoffset0DataType", DbType="datetimeoffset(0)", DataType=DataType.DateTimeOffset, Precision=0), Nullable ] public DateTimeOffset? Datetimeoffset0DataType { get; set; } // datetimeoffset(0) + [Column("datetimeoffset1DataType", DbType="datetimeoffset(1)", DataType=DataType.DateTimeOffset, Precision=1), Nullable ] public DateTimeOffset? Datetimeoffset1DataType { get; set; } // datetimeoffset(1) + [Column("datetimeoffset2DataType", DbType="datetimeoffset(2)", DataType=DataType.DateTimeOffset, Precision=2), Nullable ] public DateTimeOffset? Datetimeoffset2DataType { get; set; } // datetimeoffset(2) + [Column("datetimeoffset3DataType", DbType="datetimeoffset(3)", DataType=DataType.DateTimeOffset, Precision=3), Nullable ] public DateTimeOffset? Datetimeoffset3DataType { get; set; } // datetimeoffset(3) + [Column("datetimeoffset4DataType", DbType="datetimeoffset(4)", DataType=DataType.DateTimeOffset, Precision=4), Nullable ] public DateTimeOffset? Datetimeoffset4DataType { get; set; } // datetimeoffset(4) + [Column("datetimeoffset5DataType", DbType="datetimeoffset(5)", DataType=DataType.DateTimeOffset, Precision=5), Nullable ] public DateTimeOffset? Datetimeoffset5DataType { get; set; } // datetimeoffset(5) + [Column("datetimeoffset6DataType", DbType="datetimeoffset(6)", DataType=DataType.DateTimeOffset, Precision=6), Nullable ] public DateTimeOffset? Datetimeoffset6DataType { get; set; } // datetimeoffset(6) + [Column("datetimeoffset7DataType", DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? Datetimeoffset7DataType { get; set; } // datetimeoffset(7) + [Column("dateDataType", DbType="date", DataType=DataType.Date), Nullable ] public DateTime? DateDataType { get; set; } // date + [Column("timeDataType", DbType="time(7)", DataType=DataType.Time, Precision=7), Nullable ] public TimeSpan? TimeDataType { get; set; } // time(7) } [Table(Database="TestData", Name="AllTypes2")] public partial class AllTypes2 { - [Column(DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int - [Column(DbType="date", DataType=DataType.Date), Nullable ] public DateTime? dateDataType { get; set; } // date - [Column(DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? datetimeoffsetDataType { get; set; } // datetimeoffset(7) - [Column(DbType="datetime2(7)", DataType=DataType.DateTime2, Precision=7), Nullable ] public DateTime? datetime2DataType { get; set; } // datetime2(7) - [Column(DbType="time(7)", DataType=DataType.Time, Precision=7), Nullable ] public TimeSpan? timeDataType { get; set; } // time(7) - [Column(DbType="hierarchyid", DataType=DataType.Udt), Nullable ] public SqlHierarchyId? hierarchyidDataType { get; set; } // hierarchyid - [Column(DbType="geography", DataType=DataType.Udt), Nullable ] public SqlGeography geographyDataType { get; set; } // geography - [Column(DbType="geometry", DataType=DataType.Udt), Nullable ] public SqlGeometry geometryDataType { get; set; } // geometry + [Column( DbType="int", DataType=DataType.Int32), PrimaryKey, Identity] public int ID { get; set; } // int + [Column("dateDataType", DbType="date", DataType=DataType.Date), Nullable ] public DateTime? DateDataType { get; set; } // date + [Column("datetimeoffsetDataType", DbType="datetimeoffset(7)", DataType=DataType.DateTimeOffset, Precision=7), Nullable ] public DateTimeOffset? DatetimeoffsetDataType { get; set; } // datetimeoffset(7) + [Column("datetime2DataType", DbType="datetime2(7)", DataType=DataType.DateTime2, Precision=7), Nullable ] public DateTime? Datetime2DataType { get; set; } // datetime2(7) + [Column("timeDataType", DbType="time(7)", DataType=DataType.Time, Precision=7), Nullable ] public TimeSpan? TimeDataType { get; set; } // time(7) + [Column("hierarchyidDataType", DbType="hierarchyid", DataType=DataType.Udt), Nullable ] public SqlHierarchyId? HierarchyidDataType { get; set; } // hierarchyid + [Column("geographyDataType", DbType="geography", DataType=DataType.Udt), Nullable ] public SqlGeography GeographyDataType { get; set; } // geography + [Column("geometryDataType", DbType="geometry", DataType=DataType.Udt), Nullable ] public SqlGeometry GeometryDataType { get; set; } // geometry } [Table(Database="TestData", Name="BinaryData")] @@ -1038,39 +1060,39 @@ namespace DataModel [Table(Database="TestData", Name="Child")] public partial class Child { - [Column(DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int + [Column( DbType="int", DataType=DataType.Int32), Nullable ] public int? ParentID { get; set; } // int /// /// 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 @@ namespace DataModel [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 @@ namespace DataModel /// 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 @@ namespace DataModel /// /// 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 @@ namespace DataModel [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 @@ namespace DataModel [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 @@ namespace DataModel [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 @@ namespace DataModel 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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel #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 @@ namespace DataModel 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 @@ namespace DataModel 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 @@ namespace DataModel 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 @@ namespace DataModel 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..d933d34 100644 --- a/Tests/LinqToDB/T4Model.LinqToDB.csproj +++ b/Tests/LinqToDB/T4Model.LinqToDB.csproj @@ -43,9 +43,11 @@ ..\..\packages\linq2db.1.8.2\lib\net45\linq2db.dll + True - - ..\..\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll + + ..\..\packages\Microsoft.SqlServer.Types.11.0.2\lib\net20\Microsoft.SqlServer.Types.dll + True ..\..\packages\Npgsql.2.2.6\lib\net45\Mono.Security.dll @@ -205,19 +207,23 @@ + + SqlServerTypes\x64\msvcr100.dll + PreserveNewest + + + SqlServerTypes\x64\SqlServerSpatial110.dll + PreserveNewest + + + SqlServerTypes\x86\msvcr100.dll + PreserveNewest + + + SqlServerTypes\x86\SqlServerSpatial110.dll + PreserveNewest + - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest -