diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/LICENSE.txt b/LICENSE.txt index 2a0873f..d525254 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------- -Linq to SQL2 is (c) 2010-2014 Solutions Design bv. All rights reserved. +Linq to SQL2 is (c) Solutions Design bv. All rights reserved. http://www.sd.nl COPYRIGHTS: diff --git a/src/System.Data.Linq.resources b/src/Main.resources similarity index 100% rename from src/System.Data.Linq.resources rename to src/Main.resources diff --git a/src/System.Data.Linq.Mapping.resources b/src/Mapping.resources similarity index 100% rename from src/System.Data.Linq.Mapping.resources rename to src/Mapping.resources diff --git a/src/SD.Tools.LinqToSQL2.csproj b/src/SD.Tools.LinqToSQL2.csproj index 04abd29..311b390 100644 --- a/src/SD.Tools.LinqToSQL2.csproj +++ b/src/SD.Tools.LinqToSQL2.csproj @@ -251,9 +251,9 @@ - - - + + + diff --git a/src/System.Data.Linq.SqlClient.resources b/src/SqlClient.resources similarity index 100% rename from src/System.Data.Linq.SqlClient.resources rename to src/SqlClient.resources diff --git a/tests/AdventureWorks2008Model/AdventureWorks2008.csproj b/tests/AdventureWorks2008Model/AdventureWorks2008.csproj new file mode 100644 index 0000000..5866b1b --- /dev/null +++ b/tests/AdventureWorks2008Model/AdventureWorks2008.csproj @@ -0,0 +1,306 @@ + + + + Debug + AnyCPU + 9.0.30703 + 2.0 + {26A446B2-7479-4DCB-A13B-C2A97F128A36} + Library + Properties + AdventureWorks2008 + AdventureWorks2008 + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + ..\ReadTestsAdventureWorks2008\packages\Microsoft.SqlServer.Types.11.0.2\lib\net20\Microsoft.SqlServer.Types.dll + + + ..\..\src\bin\Debug\SD.Tools.LinqToSQL2.dll + + + + + + + + + + + + + + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + LLBLGen Pro + + + + + SqlServerTypes\x64\msvcr100.dll + PreserveNewest + + + SqlServerTypes\x64\SqlServerSpatial110.dll + PreserveNewest + + + SqlServerTypes\x86\msvcr100.dll + PreserveNewest + + + SqlServerTypes\x86\SqlServerSpatial110.dll + PreserveNewest + + + + + \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/AdventureWorks2008DataContext.cs b/tests/AdventureWorks2008Model/AdventureWorks2008DataContext.cs new file mode 100644 index 0000000..4c827d0 --- /dev/null +++ b/tests/AdventureWorks2008Model/AdventureWorks2008DataContext.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data; +using System.Data.Common; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.Configuration; +using System.Data.SqlClient; +using System.Linq; +using System.Reflection; +using ReadTestsAdventureWorks2008.EntityClasses; +using ReadTestsAdventureWorks2008.TypedViewClasses; + +namespace ReadTestsAdventureWorks2008 +{ + /// Class which represents the DataContext for the project / group 'AdventureWorks2008' + /// Targets the catalog(s): 'AdventureWorks' + public partial class AdventureWorks2008DataContext : System.Data.Linq.DataContext + { + private static readonly System.Data.Linq.Mapping.MappingSource _mappingSource = new AttributeMappingSource(); + + #region Extensibility Method Definitions + partial void OnCreated(); + #endregion + + /// Initializes a new instance of the class. + public AdventureWorks2008DataContext() : + base(ConfigurationManager.ConnectionStrings["AdventureWorksConnectionString.SQL Server (SqlClient)"].ConnectionString, _mappingSource) + { + OnCreated(); + } + + /// Initializes a new instance of the class. + /// The mapping source. + public AdventureWorks2008DataContext(System.Data.Linq.Mapping.MappingSource mappingSource) : + base(ConfigurationManager.ConnectionStrings["AdventureWorksConnectionString.SQL Server (SqlClient)"].ConnectionString, mappingSource) + { + OnCreated(); + } + + /// Initializes a new instance of the class. + /// The connection. + public AdventureWorks2008DataContext(string connection) : + base(connection, _mappingSource) + { + OnCreated(); + } + + /// Initializes a new instance of the class. + /// The connection. + public AdventureWorks2008DataContext(System.Data.IDbConnection connection) : + base(connection, _mappingSource) + { + OnCreated(); + } + + /// Initializes a new instance of the class. + /// The connection. + /// The mapping source. + public AdventureWorks2008DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + base(connection, mappingSource) + { + OnCreated(); + } + + /// Initializes a new instance of the class. + /// The connection. + /// The mapping source. + public AdventureWorks2008DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + base(connection, mappingSource) + { + OnCreated(); + } + + /// Gets an open DbDataReader instance with the results of the query specified + /// The query to execute + /// An open DbDataReader instance with the results of the query specified + /// The command behavior is set to CloseConnection. + public DbDataReader GetQueryAsDataReader(IQueryable query) + { + return SetupCommand(GetCommand(query), true).ExecuteReader(CommandBehavior.CloseConnection); + } + + /// Calls the stored procedure '[dbo].[uspGetBillOfMaterials]' and fills the typedview(s): 'BillOfRightsResult' + /// Parameter mapped onto the stored procedure parameter '@StartProductID' + /// Parameter mapped onto the stored procedure parameter '@CheckDate' + /// A single result object which contains the filled typedview 'BillOfRightsResult' + public ISingleResult GetBillOfRightsResult(System.Int32 StartProductID, System.DateTime CheckDate) + { + IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodBase.GetCurrentMethod())), StartProductID, CheckDate); + return (ISingleResult)(result.ReturnValue); + } + + /// Gets the Address Table definition. Mapped on table 'AdventureWorks.Person.Address'. + public System.Data.Linq.Table
Addresses + { + get { return this.GetTable
(); } + } + + /// Gets the AddressType Table definition. Mapped on table 'AdventureWorks.Person.AddressType'. + public System.Data.Linq.Table AddressTypes + { + get { return this.GetTable(); } + } + + /// Gets the AwbuildVersion Table definition. Mapped on table 'AdventureWorks.dbo.AWBuildVersion'. + public System.Data.Linq.Table AwbuildVersions + { + get { return this.GetTable(); } + } + + /// Gets the BillOfMaterial Table definition. Mapped on table 'AdventureWorks.Production.BillOfMaterials'. + public System.Data.Linq.Table BillOfMaterials + { + get { return this.GetTable(); } + } + + /// Gets the BusinessEntity Table definition. Mapped on table 'AdventureWorks.Person.BusinessEntity'. + public System.Data.Linq.Table BusinessEntities + { + get { return this.GetTable(); } + } + + /// Gets the BusinessEntityAddress Table definition. Mapped on table 'AdventureWorks.Person.BusinessEntityAddress'. + public System.Data.Linq.Table BusinessEntityAddresses + { + get { return this.GetTable(); } + } + + /// Gets the BusinessEntityContact Table definition. Mapped on table 'AdventureWorks.Person.BusinessEntityContact'. + public System.Data.Linq.Table BusinessEntityContacts + { + get { return this.GetTable(); } + } + + /// Gets the ContactType Table definition. Mapped on table 'AdventureWorks.Person.ContactType'. + public System.Data.Linq.Table ContactTypes + { + get { return this.GetTable(); } + } + + /// Gets the CountryRegion Table definition. Mapped on table 'AdventureWorks.Person.CountryRegion'. + public System.Data.Linq.Table CountryRegions + { + get { return this.GetTable(); } + } + + /// Gets the CountryRegionCurrency Table definition. Mapped on table 'AdventureWorks.Sales.CountryRegionCurrency'. + public System.Data.Linq.Table CountryRegionCurrencies + { + get { return this.GetTable(); } + } + + /// Gets the CreditCard Table definition. Mapped on table 'AdventureWorks.Sales.CreditCard'. + public System.Data.Linq.Table CreditCards + { + get { return this.GetTable(); } + } + + /// Gets the Culture Table definition. Mapped on table 'AdventureWorks.Production.Culture'. + public System.Data.Linq.Table Cultures + { + get { return this.GetTable(); } + } + + /// Gets the Currency Table definition. Mapped on table 'AdventureWorks.Sales.Currency'. + public System.Data.Linq.Table Currencies + { + get { return this.GetTable(); } + } + + /// Gets the CurrencyRate Table definition. Mapped on table 'AdventureWorks.Sales.CurrencyRate'. + public System.Data.Linq.Table CurrencyRates + { + get { return this.GetTable(); } + } + + /// Gets the Customer Table definition. Mapped on table 'AdventureWorks.Sales.Customer'. + public System.Data.Linq.Table Customers + { + get { return this.GetTable(); } + } + + /// Gets the DatabaseLog Table definition. Mapped on table 'AdventureWorks.dbo.DatabaseLog'. + public System.Data.Linq.Table DatabaseLogs + { + get { return this.GetTable(); } + } + + /// Gets the Department Table definition. Mapped on table 'AdventureWorks.HumanResources.Department'. + public System.Data.Linq.Table Departments + { + get { return this.GetTable(); } + } + + /// Gets the Document Table definition. Mapped on table 'AdventureWorks.Production.Document'. + public System.Data.Linq.Table Documents + { + get { return this.GetTable(); } + } + + /// Gets the EmailAddress Table definition. Mapped on table 'AdventureWorks.Person.EmailAddress'. + public System.Data.Linq.Table EmailAddresses + { + get { return this.GetTable(); } + } + + /// Gets the Employee Table definition. Mapped on table 'AdventureWorks.HumanResources.Employee'. + public System.Data.Linq.Table Employees + { + get { return this.GetTable(); } + } + + /// Gets the EmployeeDepartmentHistory Table definition. Mapped on table 'AdventureWorks.HumanResources.EmployeeDepartmentHistory'. + public System.Data.Linq.Table EmployeeDepartmentHistories + { + get { return this.GetTable(); } + } + + /// Gets the EmployeePayHistory Table definition. Mapped on table 'AdventureWorks.HumanResources.EmployeePayHistory'. + public System.Data.Linq.Table EmployeePayHistories + { + get { return this.GetTable(); } + } + + /// Gets the ErrorLog Table definition. Mapped on table 'AdventureWorks.dbo.ErrorLog'. + public System.Data.Linq.Table ErrorLogs + { + get { return this.GetTable(); } + } + + /// Gets the Illustration Table definition. Mapped on table 'AdventureWorks.Production.Illustration'. + public System.Data.Linq.Table Illustrations + { + get { return this.GetTable(); } + } + + /// Gets the JobCandidate Table definition. Mapped on table 'AdventureWorks.HumanResources.JobCandidate'. + public System.Data.Linq.Table JobCandidates + { + get { return this.GetTable(); } + } + + /// Gets the Location Table definition. Mapped on table 'AdventureWorks.Production.Location'. + public System.Data.Linq.Table Locations + { + get { return this.GetTable(); } + } + + /// Gets the Password Table definition. Mapped on table 'AdventureWorks.Person.Password'. + public System.Data.Linq.Table Passwords + { + get { return this.GetTable(); } + } + + /// Gets the Person Table definition. Mapped on table 'AdventureWorks.Person.Person'. + public System.Data.Linq.Table People + { + get { return this.GetTable(); } + } + + /// Gets the PersonCreditCard Table definition. Mapped on table 'AdventureWorks.Sales.PersonCreditCard'. + public System.Data.Linq.Table PersonCreditCards + { + get { return this.GetTable(); } + } + + /// Gets the PersonPhone Table definition. Mapped on table 'AdventureWorks.Person.PersonPhone'. + public System.Data.Linq.Table PersonPhones + { + get { return this.GetTable(); } + } + + /// Gets the PhoneNumberType Table definition. Mapped on table 'AdventureWorks.Person.PhoneNumberType'. + public System.Data.Linq.Table PhoneNumberTypes + { + get { return this.GetTable(); } + } + + /// Gets the Product Table definition. Mapped on table 'AdventureWorks.Production.Product'. + public System.Data.Linq.Table Products + { + get { return this.GetTable(); } + } + + /// Gets the ProductCategory Table definition. Mapped on table 'AdventureWorks.Production.ProductCategory'. + public System.Data.Linq.Table ProductCategories + { + get { return this.GetTable(); } + } + + /// Gets the ProductCostHistory Table definition. Mapped on table 'AdventureWorks.Production.ProductCostHistory'. + public System.Data.Linq.Table ProductCostHistories + { + get { return this.GetTable(); } + } + + /// Gets the ProductDescription Table definition. Mapped on table 'AdventureWorks.Production.ProductDescription'. + public System.Data.Linq.Table ProductDescriptions + { + get { return this.GetTable(); } + } + + /// Gets the ProductDocument Table definition. Mapped on table 'AdventureWorks.Production.ProductDocument'. + public System.Data.Linq.Table ProductDocuments + { + get { return this.GetTable(); } + } + + /// Gets the ProductInventory Table definition. Mapped on table 'AdventureWorks.Production.ProductInventory'. + public System.Data.Linq.Table ProductInventories + { + get { return this.GetTable(); } + } + + /// Gets the ProductListPriceHistory Table definition. Mapped on table 'AdventureWorks.Production.ProductListPriceHistory'. + public System.Data.Linq.Table ProductListPriceHistories + { + get { return this.GetTable(); } + } + + /// Gets the ProductModel Table definition. Mapped on table 'AdventureWorks.Production.ProductModel'. + public System.Data.Linq.Table ProductModels + { + get { return this.GetTable(); } + } + + /// Gets the ProductModelIllustration Table definition. Mapped on table 'AdventureWorks.Production.ProductModelIllustration'. + public System.Data.Linq.Table ProductModelIllustrations + { + get { return this.GetTable(); } + } + + /// Gets the ProductModelProductDescriptionCulture Table definition. Mapped on table 'AdventureWorks.Production.ProductModelProductDescriptionCulture'. + public System.Data.Linq.Table ProductModelProductDescriptionCultures + { + get { return this.GetTable(); } + } + + /// Gets the ProductPhoto Table definition. Mapped on table 'AdventureWorks.Production.ProductPhoto'. + public System.Data.Linq.Table ProductPhotos + { + get { return this.GetTable(); } + } + + /// Gets the ProductProductPhoto Table definition. Mapped on table 'AdventureWorks.Production.ProductProductPhoto'. + public System.Data.Linq.Table ProductProductPhotos + { + get { return this.GetTable(); } + } + + /// Gets the ProductReview Table definition. Mapped on table 'AdventureWorks.Production.ProductReview'. + public System.Data.Linq.Table ProductReviews + { + get { return this.GetTable(); } + } + + /// Gets the ProductSubcategory Table definition. Mapped on table 'AdventureWorks.Production.ProductSubcategory'. + public System.Data.Linq.Table ProductSubcategories + { + get { return this.GetTable(); } + } + + /// Gets the ProductVendor Table definition. Mapped on table 'AdventureWorks.Purchasing.ProductVendor'. + public System.Data.Linq.Table ProductVendors + { + get { return this.GetTable(); } + } + + /// Gets the PurchaseOrderDetail Table definition. Mapped on table 'AdventureWorks.Purchasing.PurchaseOrderDetail'. + public System.Data.Linq.Table PurchaseOrderDetails + { + get { return this.GetTable(); } + } + + /// Gets the PurchaseOrderHeader Table definition. Mapped on table 'AdventureWorks.Purchasing.PurchaseOrderHeader'. + public System.Data.Linq.Table PurchaseOrderHeaders + { + get { return this.GetTable(); } + } + + /// Gets the SalesOrderDetail Table definition. Mapped on table 'AdventureWorks.Sales.SalesOrderDetail'. + public System.Data.Linq.Table SalesOrderDetails + { + get { return this.GetTable(); } + } + + /// Gets the SalesOrderHeader Table definition. Mapped on table 'AdventureWorks.Sales.SalesOrderHeader'. + public System.Data.Linq.Table SalesOrderHeaders + { + get { return this.GetTable(); } + } + + /// Gets the SalesOrderHeaderSalesReason Table definition. Mapped on table 'AdventureWorks.Sales.SalesOrderHeaderSalesReason'. + public System.Data.Linq.Table SalesOrderHeaderSalesReasons + { + get { return this.GetTable(); } + } + + /// Gets the SalesPerson Table definition. Mapped on table 'AdventureWorks.Sales.SalesPerson'. + public System.Data.Linq.Table SalesPeople + { + get { return this.GetTable(); } + } + + /// Gets the SalesPersonQuotaHistory Table definition. Mapped on table 'AdventureWorks.Sales.SalesPersonQuotaHistory'. + public System.Data.Linq.Table SalesPersonQuotaHistories + { + get { return this.GetTable(); } + } + + /// Gets the SalesReason Table definition. Mapped on table 'AdventureWorks.Sales.SalesReason'. + public System.Data.Linq.Table SalesReasons + { + get { return this.GetTable(); } + } + + /// Gets the SalesTaxRate Table definition. Mapped on table 'AdventureWorks.Sales.SalesTaxRate'. + public System.Data.Linq.Table SalesTaxRates + { + get { return this.GetTable(); } + } + + /// Gets the SalesTerritory Table definition. Mapped on table 'AdventureWorks.Sales.SalesTerritory'. + public System.Data.Linq.Table SalesTerritories + { + get { return this.GetTable(); } + } + + /// Gets the SalesTerritoryHistory Table definition. Mapped on table 'AdventureWorks.Sales.SalesTerritoryHistory'. + public System.Data.Linq.Table SalesTerritoryHistories + { + get { return this.GetTable(); } + } + + /// Gets the ScrapReason Table definition. Mapped on table 'AdventureWorks.Production.ScrapReason'. + public System.Data.Linq.Table ScrapReasons + { + get { return this.GetTable(); } + } + + /// Gets the Shift Table definition. Mapped on table 'AdventureWorks.HumanResources.Shift'. + public System.Data.Linq.Table Shifts + { + get { return this.GetTable(); } + } + + /// Gets the ShipMethod Table definition. Mapped on table 'AdventureWorks.Purchasing.ShipMethod'. + public System.Data.Linq.Table ShipMethods + { + get { return this.GetTable(); } + } + + /// Gets the ShoppingCartItem Table definition. Mapped on table 'AdventureWorks.Sales.ShoppingCartItem'. + public System.Data.Linq.Table ShoppingCartItems + { + get { return this.GetTable(); } + } + + /// Gets the SpecialOffer Table definition. Mapped on table 'AdventureWorks.Sales.SpecialOffer'. + public System.Data.Linq.Table SpecialOffers + { + get { return this.GetTable(); } + } + + /// Gets the SpecialOfferProduct Table definition. Mapped on table 'AdventureWorks.Sales.SpecialOfferProduct'. + public System.Data.Linq.Table SpecialOfferProducts + { + get { return this.GetTable(); } + } + + /// Gets the StateProvince Table definition. Mapped on table 'AdventureWorks.Person.StateProvince'. + public System.Data.Linq.Table StateProvinces + { + get { return this.GetTable(); } + } + + /// Gets the Store Table definition. Mapped on table 'AdventureWorks.Sales.Store'. + public System.Data.Linq.Table Stores + { + get { return this.GetTable(); } + } + + /// Gets the TransactionHistory Table definition. Mapped on table 'AdventureWorks.Production.TransactionHistory'. + public System.Data.Linq.Table TransactionHistories + { + get { return this.GetTable(); } + } + + /// Gets the TransactionHistoryArchive Table definition. Mapped on table 'AdventureWorks.Production.TransactionHistoryArchive'. + public System.Data.Linq.Table TransactionHistoryArchives + { + get { return this.GetTable(); } + } + + /// Gets the UnitMeasure Table definition. Mapped on table 'AdventureWorks.Production.UnitMeasure'. + public System.Data.Linq.Table UnitMeasures + { + get { return this.GetTable(); } + } + + /// Gets the Vendor Table definition. Mapped on table 'AdventureWorks.Purchasing.Vendor'. + public System.Data.Linq.Table Vendors + { + get { return this.GetTable(); } + } + + /// Gets the WorkOrder Table definition. Mapped on table 'AdventureWorks.Production.WorkOrder'. + public System.Data.Linq.Table WorkOrders + { + get { return this.GetTable(); } + } + + /// Gets the WorkOrderRouting Table definition. Mapped on table 'AdventureWorks.Production.WorkOrderRouting'. + public System.Data.Linq.Table WorkOrderRoutings + { + get { return this.GetTable(); } + } + + /// Calls the Table-valued-function '[dbo].[ufnGetContactInformation]' and returns instances of type 'UfnGetContactInformationResultTypedViewRow' + /// parameter of the TVF + public IQueryable UfnGetContactInformation(System.Int32 personId) + { + return this.CreateMethodCallQuery(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), personId); + } + + /// Sets up the command specified. It wires it to the current connection and transaction, sets command timeout and if requested, it also opens the command + /// The command to setup + /// If set to true, the connection is also opened if it's not already open, otherwise it's left as-is + /// The passed in DbCommand + private DbCommand SetupCommand(DbCommand toSetup, bool openConnection) + { + if(toSetup==null) + { + return toSetup; + } + toSetup.Connection = this.Connection; + toSetup.Transaction = this.Transaction; + toSetup.CommandTimeout = this.CommandTimeout; + if((toSetup.Connection!=null) && openConnection && (toSetup.Connection.State!=ConnectionState.Open)) + { + toSetup.Connection.Open(); + } + return toSetup; + } + + /// Creates a new stored procedure call command and sets it up to make it ready to use. + /// The stored procedure to call. + /// ready to use command + private DbCommand CreateStoredProcCallCommand(string storedProcedureToCall) + { + var cmd = this.Connection.CreateCommand(); + cmd.CommandType = CommandType.StoredProcedure; + cmd.CommandText = storedProcedureToCall; + return SetupCommand(cmd, false); + } + + /// Adds a new parameter created from the input specified to the command specified + /// The command to add the new parameter to + /// Name of the parameter. + /// The type. + /// The length. + /// The direction. + /// The value for the parameter + private static void AddParameter(DbCommand cmd, string parameterName, SqlDbType type, int length, ParameterDirection direction, object value) + { + cmd.Parameters.Add(new SqlParameter(parameterName, type, length) { Direction = direction, Value = value }); + } + + } +} diff --git a/tests/AdventureWorks2008Model/AdventureWorks2008Mappings.xml b/tests/AdventureWorks2008Model/AdventureWorks2008Mappings.xml new file mode 100644 index 0000000..32ec9ce --- /dev/null +++ b/tests/AdventureWorks2008Model/AdventureWorks2008Mappings.xml @@ -0,0 +1,976 @@ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + +
+ diff --git a/tests/AdventureWorks2008Model/App.config b/tests/AdventureWorks2008Model/App.config new file mode 100644 index 0000000..dfd7a56 --- /dev/null +++ b/tests/AdventureWorks2008Model/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/AdventureWorks2008Model/EntityClasses/Address.cs b/tests/AdventureWorks2008Model/EntityClasses/Address.cs new file mode 100644 index 0000000..00dc08c --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Address.cs @@ -0,0 +1,353 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Address', mapped on table 'AdventureWorks.Person.Address'. + public partial class Address : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _addressLine1; + private System.String _addressLine2; + private System.String _city; + private System.Int32 _id; + private System.DateTime _modifiedDate; + private System.String _postalCode; + private System.Guid _rowguid; + private Microsoft.SqlServer.Types.SqlGeography _spatialLocation; + private System.Int32 _stateProvinceId; + private EntitySet _businessEntityAddresses; + private EntitySet _salesOrderHeaders; + private EntitySet _salesOrderHeaders1; + private EntityRef _stateProvince; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAddressLine1Changing(System.String value); + partial void OnAddressLine1Changed(); + partial void OnAddressLine2Changing(System.String value); + partial void OnAddressLine2Changed(); + partial void OnCityChanging(System.String value); + partial void OnCityChanged(); + partial void OnIdChanging(System.Int32 value); + partial void OnIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPostalCodeChanging(System.String value); + partial void OnPostalCodeChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSpatialLocationChanging(Microsoft.SqlServer.Types.SqlGeography value); + partial void OnSpatialLocationChanged(); + partial void OnStateProvinceIdChanging(System.Int32 value); + partial void OnStateProvinceIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public Address() + { + _businessEntityAddresses = new EntitySet(new Action(this.Attach_BusinessEntityAddresses), new Action(this.Detach_BusinessEntityAddresses) ); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + _salesOrderHeaders1 = new EntitySet(new Action(this.Attach_SalesOrderHeaders1), new Action(this.Detach_SalesOrderHeaders1) ); + _stateProvince = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.Address = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.Address = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.Address = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.Address = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders1(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders1"); + entity.Address1 = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders1(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders1"); + entity.Address1 = null; + } + + + #region Class Property Declarations + /// Gets or sets the AddressLine1 field. Mapped on target field 'AddressLine1'. + public System.String AddressLine1 + { + get { return _addressLine1; } + set + { + if((_addressLine1 != value)) + { + OnAddressLine1Changing(value); + SendPropertyChanging("AddressLine1"); + _addressLine1 = value; + SendPropertyChanged("AddressLine1"); + OnAddressLine1Changed(); + } + } + } + + /// Gets or sets the AddressLine2 field. Mapped on target field 'AddressLine2'. + public System.String AddressLine2 + { + get { return _addressLine2; } + set + { + if((_addressLine2 != value)) + { + OnAddressLine2Changing(value); + SendPropertyChanging("AddressLine2"); + _addressLine2 = value; + SendPropertyChanged("AddressLine2"); + OnAddressLine2Changed(); + } + } + } + + /// Gets or sets the City field. Mapped on target field 'City'. + public System.String City + { + get { return _city; } + set + { + if((_city != value)) + { + OnCityChanging(value); + SendPropertyChanging("City"); + _city = value; + SendPropertyChanged("City"); + OnCityChanged(); + } + } + } + + /// Gets or sets the Id field. Mapped on target field 'AddressID'. + public System.Int32 Id + { + get { return _id; } + set + { + if((_id != value)) + { + OnIdChanging(value); + SendPropertyChanging("Id"); + _id = value; + SendPropertyChanged("Id"); + OnIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PostalCode field. Mapped on target field 'PostalCode'. + public System.String PostalCode + { + get { return _postalCode; } + set + { + if((_postalCode != value)) + { + OnPostalCodeChanging(value); + SendPropertyChanging("PostalCode"); + _postalCode = value; + SendPropertyChanged("PostalCode"); + OnPostalCodeChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SpatialLocation field. Mapped on target field 'SpatialLocation'. + public Microsoft.SqlServer.Types.SqlGeography SpatialLocation + { + get { return _spatialLocation; } + set + { + if((_spatialLocation != value)) + { + OnSpatialLocationChanging(value); + SendPropertyChanging("SpatialLocation"); + _spatialLocation = value; + SendPropertyChanged("SpatialLocation"); + OnSpatialLocationChanged(); + } + } + } + + /// Gets or sets the StateProvinceId field. Mapped on target field 'StateProvinceID'. + public System.Int32 StateProvinceId + { + get { return _stateProvinceId; } + set + { + if((_stateProvinceId != value)) + { + if(_stateProvince.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnStateProvinceIdChanging(value); + SendPropertyChanging("StateProvinceId"); + _stateProvinceId = value; + SendPropertyChanged("StateProvinceId"); + OnStateProvinceIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.Address - Address.BusinessEntityAddresses (m:1)' + public EntitySet BusinessEntityAddresses + { + get { return this._businessEntityAddresses; } + set { this._businessEntityAddresses.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address - Address.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address1 - Address.SalesOrderHeaders1 (m:1)' + public EntitySet SalesOrderHeaders1 + { + get { return this._salesOrderHeaders1; } + set { this._salesOrderHeaders1.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Address.StateProvince - StateProvince.Addresses (m:1)' + public StateProvince StateProvince + { + get { return _stateProvince.Entity; } + set + { + StateProvince previousValue = _stateProvince.Entity; + if((previousValue != value) || (_stateProvince.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("StateProvince"); + if(previousValue != null) + { + _stateProvince.Entity = null; + previousValue.Addresses.Remove(this); + } + _stateProvince.Entity = value; + if(value == null) + { + _stateProvinceId = default(System.Int32); + } + else + { + value.Addresses.Add(this); + _stateProvinceId = value.StateProvinceId; + } + this.SendPropertyChanged("StateProvince"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/AddressType.cs b/tests/AdventureWorks2008Model/EntityClasses/AddressType.cs new file mode 100644 index 0000000..9649f8f --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/AddressType.cs @@ -0,0 +1,167 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'AddressType', mapped on table 'AdventureWorks.Person.AddressType'. + public partial class AddressType : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _id; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private EntitySet _businessEntityAddresses; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIdChanging(System.Int32 value); + partial void OnIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public AddressType() + { + _businessEntityAddresses = new EntitySet(new Action(this.Attach_BusinessEntityAddresses), new Action(this.Detach_BusinessEntityAddresses) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.AddressType = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.AddressType = null; + } + + + #region Class Property Declarations + /// Gets or sets the Id field. Mapped on target field 'AddressTypeID'. + public System.Int32 Id + { + get { return _id; } + set + { + if((_id != value)) + { + OnIdChanging(value); + SendPropertyChanging("Id"); + _id = value; + SendPropertyChanged("Id"); + OnIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.AddressType - AddressType.BusinessEntityAddresses (m:1)' + public EntitySet BusinessEntityAddresses + { + get { return this._businessEntityAddresses; } + set { this._businessEntityAddresses.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/AwbuildVersion.cs b/tests/AdventureWorks2008Model/EntityClasses/AwbuildVersion.cs new file mode 100644 index 0000000..a470f52 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/AwbuildVersion.cs @@ -0,0 +1,142 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'AwbuildVersion', mapped on table 'AdventureWorks.dbo.AWBuildVersion'. + public partial class AwbuildVersion : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _databaseVersion; + private System.DateTime _modifiedDate; + private System.Byte _systemInformationId; + private System.DateTime _versionDate; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDatabaseVersionChanging(System.String value); + partial void OnDatabaseVersionChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnSystemInformationIdChanging(System.Byte value); + partial void OnSystemInformationIdChanged(); + partial void OnVersionDateChanging(System.DateTime value); + partial void OnVersionDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public AwbuildVersion() + { + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the DatabaseVersion field. Mapped on target field 'Database Version'. + public System.String DatabaseVersion + { + get { return _databaseVersion; } + set + { + if((_databaseVersion != value)) + { + OnDatabaseVersionChanging(value); + SendPropertyChanging("DatabaseVersion"); + _databaseVersion = value; + SendPropertyChanged("DatabaseVersion"); + OnDatabaseVersionChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the SystemInformationId field. Mapped on target field 'SystemInformationID'. + public System.Byte SystemInformationId + { + get { return _systemInformationId; } + set + { + if((_systemInformationId != value)) + { + OnSystemInformationIdChanging(value); + SendPropertyChanging("SystemInformationId"); + _systemInformationId = value; + SendPropertyChanged("SystemInformationId"); + OnSystemInformationIdChanged(); + } + } + } + + /// Gets or sets the VersionDate field. Mapped on target field 'VersionDate'. + public System.DateTime VersionDate + { + get { return _versionDate; } + set + { + if((_versionDate != value)) + { + OnVersionDateChanging(value); + SendPropertyChanging("VersionDate"); + _versionDate = value; + SendPropertyChanged("VersionDate"); + OnVersionDateChanged(); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/BillOfMaterial.cs b/tests/AdventureWorks2008Model/EntityClasses/BillOfMaterial.cs new file mode 100644 index 0000000..9503292 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/BillOfMaterial.cs @@ -0,0 +1,350 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'BillOfMaterial', mapped on table 'AdventureWorks.Production.BillOfMaterials'. + public partial class BillOfMaterial : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _billOfMaterialsId; + private System.Int16 _bomlevel; + private System.Int32 _componentId; + private Nullable _endDate; + private System.DateTime _modifiedDate; + private System.Decimal _perAssemblyQty; + private Nullable _productAssemblyId; + private System.DateTime _startDate; + private System.String _unitMeasureCode; + private EntityRef _product; + private EntityRef _product1; + private EntityRef _unitMeasure; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBillOfMaterialsIdChanging(System.Int32 value); + partial void OnBillOfMaterialsIdChanged(); + partial void OnBomlevelChanging(System.Int16 value); + partial void OnBomlevelChanged(); + partial void OnComponentIdChanging(System.Int32 value); + partial void OnComponentIdChanged(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPerAssemblyQtyChanging(System.Decimal value); + partial void OnPerAssemblyQtyChanged(); + partial void OnProductAssemblyIdChanging(Nullable value); + partial void OnProductAssemblyIdChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + partial void OnUnitMeasureCodeChanging(System.String value); + partial void OnUnitMeasureCodeChanged(); + #endregion + + /// Initializes a new instance of the class. + public BillOfMaterial() + { + _product = default(EntityRef); + _product1 = default(EntityRef); + _unitMeasure = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BillOfMaterialsId field. Mapped on target field 'BillOfMaterialsID'. + public System.Int32 BillOfMaterialsId + { + get { return _billOfMaterialsId; } + set + { + if((_billOfMaterialsId != value)) + { + OnBillOfMaterialsIdChanging(value); + SendPropertyChanging("BillOfMaterialsId"); + _billOfMaterialsId = value; + SendPropertyChanged("BillOfMaterialsId"); + OnBillOfMaterialsIdChanged(); + } + } + } + + /// Gets or sets the Bomlevel field. Mapped on target field 'BOMLevel'. + public System.Int16 Bomlevel + { + get { return _bomlevel; } + set + { + if((_bomlevel != value)) + { + OnBomlevelChanging(value); + SendPropertyChanging("Bomlevel"); + _bomlevel = value; + SendPropertyChanged("Bomlevel"); + OnBomlevelChanged(); + } + } + } + + /// Gets or sets the ComponentId field. Mapped on target field 'ComponentID'. + public System.Int32 ComponentId + { + get { return _componentId; } + set + { + if((_componentId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnComponentIdChanging(value); + SendPropertyChanging("ComponentId"); + _componentId = value; + SendPropertyChanged("ComponentId"); + OnComponentIdChanged(); + } + } + } + + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PerAssemblyQty field. Mapped on target field 'PerAssemblyQty'. + public System.Decimal PerAssemblyQty + { + get { return _perAssemblyQty; } + set + { + if((_perAssemblyQty != value)) + { + OnPerAssemblyQtyChanging(value); + SendPropertyChanging("PerAssemblyQty"); + _perAssemblyQty = value; + SendPropertyChanged("PerAssemblyQty"); + OnPerAssemblyQtyChanged(); + } + } + } + + /// Gets or sets the ProductAssemblyId field. Mapped on target field 'ProductAssemblyID'. + public Nullable ProductAssemblyId + { + get { return _productAssemblyId; } + set + { + if((_productAssemblyId != value)) + { + if(_product1.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductAssemblyIdChanging(value); + SendPropertyChanging("ProductAssemblyId"); + _productAssemblyId = value; + SendPropertyChanged("ProductAssemblyId"); + OnProductAssemblyIdChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Gets or sets the UnitMeasureCode field. Mapped on target field 'UnitMeasureCode'. + public System.String UnitMeasureCode + { + get { return _unitMeasureCode; } + set + { + if((_unitMeasureCode != value)) + { + if(_unitMeasure.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnUnitMeasureCodeChanging(value); + SendPropertyChanging("UnitMeasureCode"); + _unitMeasureCode = value; + SendPropertyChanged("UnitMeasureCode"); + OnUnitMeasureCodeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.Product - Product.BillOfMaterials (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.BillOfMaterials.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _componentId = default(System.Int32); + } + else + { + value.BillOfMaterials.Add(this); + _componentId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.Product1 - Product.BillOfMaterials1 (m:1)' + public Product Product1 + { + get { return _product1.Entity; } + set + { + Product previousValue = _product1.Entity; + if((previousValue != value) || (_product1.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product1"); + if(previousValue != null) + { + _product1.Entity = null; + previousValue.BillOfMaterials1.Remove(this); + } + _product1.Entity = value; + if(value == null) + { + _productAssemblyId = default(Nullable); + } + else + { + value.BillOfMaterials1.Add(this); + _productAssemblyId = value.ProductId; + } + this.SendPropertyChanged("Product1"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.UnitMeasure - UnitMeasure.BillOfMaterials (m:1)' + public UnitMeasure UnitMeasure + { + get { return _unitMeasure.Entity; } + set + { + UnitMeasure previousValue = _unitMeasure.Entity; + if((previousValue != value) || (_unitMeasure.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("UnitMeasure"); + if(previousValue != null) + { + _unitMeasure.Entity = null; + previousValue.BillOfMaterials.Remove(this); + } + _unitMeasure.Entity = value; + if(value == null) + { + _unitMeasureCode = default(System.String); + } + else + { + value.BillOfMaterials.Add(this); + _unitMeasureCode = value.UnitMeasureCode; + } + this.SendPropertyChanged("UnitMeasure"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/BusinessEntity.cs b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntity.cs new file mode 100644 index 0000000..531c9db --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntity.cs @@ -0,0 +1,253 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'BusinessEntity', mapped on table 'AdventureWorks.Person.BusinessEntity'. + public partial class BusinessEntity : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private EntitySet _businessEntityAddresses; + private EntitySet _businessEntityContacts; + private EntityRef _person; + private EntityRef _store; + private EntityRef _vendor; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public BusinessEntity() + { + _businessEntityAddresses = new EntitySet(new Action(this.Attach_BusinessEntityAddresses), new Action(this.Detach_BusinessEntityAddresses) ); + _businessEntityContacts = new EntitySet(new Action(this.Attach_BusinessEntityContacts), new Action(this.Detach_BusinessEntityContacts) ); + _person = default(EntityRef); + _store = default(EntityRef); + _vendor = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.BusinessEntity = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityAddresses(BusinessEntityAddress entity) + { + this.SendPropertyChanging("BusinessEntityAddresses"); + entity.BusinessEntity = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.BusinessEntity = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.BusinessEntity = null; + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.BusinessEntity - BusinessEntity.BusinessEntityAddresses (m:1)' + public EntitySet BusinessEntityAddresses + { + get { return this._businessEntityAddresses; } + set { this._businessEntityAddresses.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.BusinessEntity - BusinessEntity.BusinessEntityContacts (m:1)' + public EntitySet BusinessEntityContacts + { + get { return this._businessEntityContacts; } + set { this._businessEntityContacts.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Person.BusinessEntity - BusinessEntity.Person (1:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.BusinessEntity=null; + } + _person.Entity = value; + if(value != null) + { + value.BusinessEntity = this; + } + this.SendPropertyChanged("Person"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Store.BusinessEntity - BusinessEntity.Store (1:1)' + public Store Store + { + get { return _store.Entity; } + set + { + Store previousValue = _store.Entity; + if((previousValue != value) || (_store.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Store"); + if(previousValue != null) + { + _store.Entity = null; + previousValue.BusinessEntity=null; + } + _store.Entity = value; + if(value != null) + { + value.BusinessEntity = this; + } + this.SendPropertyChanged("Store"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Vendor.BusinessEntity - BusinessEntity.Vendor (1:1)' + public Vendor Vendor + { + get { return _vendor.Entity; } + set + { + Vendor previousValue = _vendor.Entity; + if((previousValue != value) || (_vendor.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Vendor"); + if(previousValue != null) + { + _vendor.Entity = null; + previousValue.BusinessEntity=null; + } + _vendor.Entity = value; + if(value != null) + { + value.BusinessEntity = this; + } + this.SendPropertyChanged("Vendor"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityAddress.cs b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityAddress.cs new file mode 100644 index 0000000..7441084 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityAddress.cs @@ -0,0 +1,270 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'BusinessEntityAddress', mapped on table 'AdventureWorks.Person.BusinessEntityAddress'. + public partial class BusinessEntityAddress : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _addressId; + private System.Int32 _addressTypeId; + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private EntityRef
_address; + private EntityRef _addressType; + private EntityRef _businessEntity; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAddressIdChanging(System.Int32 value); + partial void OnAddressIdChanged(); + partial void OnAddressTypeIdChanging(System.Int32 value); + partial void OnAddressTypeIdChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public BusinessEntityAddress() + { + _address = default(EntityRef
); + _addressType = default(EntityRef); + _businessEntity = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the AddressId field. Mapped on target field 'AddressID'. + public System.Int32 AddressId + { + get { return _addressId; } + set + { + if((_addressId != value)) + { + if(_address.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnAddressIdChanging(value); + SendPropertyChanging("AddressId"); + _addressId = value; + SendPropertyChanged("AddressId"); + OnAddressIdChanged(); + } + } + } + + /// Gets or sets the AddressTypeId field. Mapped on target field 'AddressTypeID'. + public System.Int32 AddressTypeId + { + get { return _addressTypeId; } + set + { + if((_addressTypeId != value)) + { + if(_addressType.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnAddressTypeIdChanging(value); + SendPropertyChanging("AddressTypeId"); + _addressTypeId = value; + SendPropertyChanged("AddressTypeId"); + OnAddressTypeIdChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_businessEntity.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.Address - Address.BusinessEntityAddresses (m:1)' + public Address Address + { + get { return _address.Entity; } + set + { + Address previousValue = _address.Entity; + if((previousValue != value) || (_address.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Address"); + if(previousValue != null) + { + _address.Entity = null; + previousValue.BusinessEntityAddresses.Remove(this); + } + _address.Entity = value; + if(value == null) + { + _addressId = default(System.Int32); + } + else + { + value.BusinessEntityAddresses.Add(this); + _addressId = value.Id; + } + this.SendPropertyChanged("Address"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.AddressType - AddressType.BusinessEntityAddresses (m:1)' + public AddressType AddressType + { + get { return _addressType.Entity; } + set + { + AddressType previousValue = _addressType.Entity; + if((previousValue != value) || (_addressType.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("AddressType"); + if(previousValue != null) + { + _addressType.Entity = null; + previousValue.BusinessEntityAddresses.Remove(this); + } + _addressType.Entity = value; + if(value == null) + { + _addressTypeId = default(System.Int32); + } + else + { + value.BusinessEntityAddresses.Add(this); + _addressTypeId = value.Id; + } + this.SendPropertyChanged("AddressType"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityAddress.BusinessEntity - BusinessEntity.BusinessEntityAddresses (m:1)' + public BusinessEntity BusinessEntity + { + get { return _businessEntity.Entity; } + set + { + BusinessEntity previousValue = _businessEntity.Entity; + if((previousValue != value) || (_businessEntity.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("BusinessEntity"); + if(previousValue != null) + { + _businessEntity.Entity = null; + previousValue.BusinessEntityAddresses.Remove(this); + } + _businessEntity.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.BusinessEntityAddresses.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("BusinessEntity"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityContact.cs b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityContact.cs new file mode 100644 index 0000000..11cdbe5 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/BusinessEntityContact.cs @@ -0,0 +1,270 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'BusinessEntityContact', mapped on table 'AdventureWorks.Person.BusinessEntityContact'. + public partial class BusinessEntityContact : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.Int32 _contactTypeId; + private System.DateTime _modifiedDate; + private System.Int32 _personId; + private System.Guid _rowguid; + private EntityRef _businessEntity; + private EntityRef _contactType; + private EntityRef _person; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnContactTypeIdChanging(System.Int32 value); + partial void OnContactTypeIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPersonIdChanging(System.Int32 value); + partial void OnPersonIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public BusinessEntityContact() + { + _businessEntity = default(EntityRef); + _contactType = default(EntityRef); + _person = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_businessEntity.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ContactTypeId field. Mapped on target field 'ContactTypeID'. + public System.Int32 ContactTypeId + { + get { return _contactTypeId; } + set + { + if((_contactTypeId != value)) + { + if(_contactType.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnContactTypeIdChanging(value); + SendPropertyChanging("ContactTypeId"); + _contactTypeId = value; + SendPropertyChanged("ContactTypeId"); + OnContactTypeIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PersonId field. Mapped on target field 'PersonID'. + public System.Int32 PersonId + { + get { return _personId; } + set + { + if((_personId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnPersonIdChanging(value); + SendPropertyChanging("PersonId"); + _personId = value; + SendPropertyChanged("PersonId"); + OnPersonIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.BusinessEntity - BusinessEntity.BusinessEntityContacts (m:1)' + public BusinessEntity BusinessEntity + { + get { return _businessEntity.Entity; } + set + { + BusinessEntity previousValue = _businessEntity.Entity; + if((previousValue != value) || (_businessEntity.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("BusinessEntity"); + if(previousValue != null) + { + _businessEntity.Entity = null; + previousValue.BusinessEntityContacts.Remove(this); + } + _businessEntity.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.BusinessEntityContacts.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("BusinessEntity"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.ContactType - ContactType.BusinessEntityContacts (m:1)' + public ContactType ContactType + { + get { return _contactType.Entity; } + set + { + ContactType previousValue = _contactType.Entity; + if((previousValue != value) || (_contactType.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ContactType"); + if(previousValue != null) + { + _contactType.Entity = null; + previousValue.BusinessEntityContacts.Remove(this); + } + _contactType.Entity = value; + if(value == null) + { + _contactTypeId = default(System.Int32); + } + else + { + value.BusinessEntityContacts.Add(this); + _contactTypeId = value.ContactTypeId; + } + this.SendPropertyChanged("ContactType"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.Person - Person.BusinessEntityContacts (m:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.BusinessEntityContacts.Remove(this); + } + _person.Entity = value; + if(value == null) + { + _personId = default(System.Int32); + } + else + { + value.BusinessEntityContacts.Add(this); + _personId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ContactType.cs b/tests/AdventureWorks2008Model/EntityClasses/ContactType.cs new file mode 100644 index 0000000..fc81c23 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ContactType.cs @@ -0,0 +1,147 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ContactType', mapped on table 'AdventureWorks.Person.ContactType'. + public partial class ContactType : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _contactTypeId; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _businessEntityContacts; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnContactTypeIdChanging(System.Int32 value); + partial void OnContactTypeIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public ContactType() + { + _businessEntityContacts = new EntitySet(new Action(this.Attach_BusinessEntityContacts), new Action(this.Detach_BusinessEntityContacts) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.ContactType = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.ContactType = null; + } + + + #region Class Property Declarations + /// Gets or sets the ContactTypeId field. Mapped on target field 'ContactTypeID'. + public System.Int32 ContactTypeId + { + get { return _contactTypeId; } + set + { + if((_contactTypeId != value)) + { + OnContactTypeIdChanging(value); + SendPropertyChanging("ContactTypeId"); + _contactTypeId = value; + SendPropertyChanged("ContactTypeId"); + OnContactTypeIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.ContactType - ContactType.BusinessEntityContacts (m:1)' + public EntitySet BusinessEntityContacts + { + get { return this._businessEntityContacts; } + set { this._businessEntityContacts.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/CountryRegion.cs b/tests/AdventureWorks2008Model/EntityClasses/CountryRegion.cs new file mode 100644 index 0000000..85d8abe --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/CountryRegion.cs @@ -0,0 +1,197 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'CountryRegion', mapped on table 'AdventureWorks.Person.CountryRegion'. + public partial class CountryRegion : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _countryRegionCode; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _countryRegionCurrencies; + private EntitySet _salesTerritories; + private EntitySet _stateProvinces; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCountryRegionCodeChanging(System.String value); + partial void OnCountryRegionCodeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public CountryRegion() + { + _countryRegionCurrencies = new EntitySet(new Action(this.Attach_CountryRegionCurrencies), new Action(this.Detach_CountryRegionCurrencies) ); + _salesTerritories = new EntitySet(new Action(this.Attach_SalesTerritories), new Action(this.Detach_SalesTerritories) ); + _stateProvinces = new EntitySet(new Action(this.Attach_StateProvinces), new Action(this.Detach_StateProvinces) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_CountryRegionCurrencies(CountryRegionCurrency entity) + { + this.SendPropertyChanging("CountryRegionCurrencies"); + entity.CountryRegion = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_CountryRegionCurrencies(CountryRegionCurrency entity) + { + this.SendPropertyChanging("CountryRegionCurrencies"); + entity.CountryRegion = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesTerritories(SalesTerritory entity) + { + this.SendPropertyChanging("SalesTerritories"); + entity.CountryRegion = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesTerritories(SalesTerritory entity) + { + this.SendPropertyChanging("SalesTerritories"); + entity.CountryRegion = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_StateProvinces(StateProvince entity) + { + this.SendPropertyChanging("StateProvinces"); + entity.CountryRegion = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_StateProvinces(StateProvince entity) + { + this.SendPropertyChanging("StateProvinces"); + entity.CountryRegion = null; + } + + + #region Class Property Declarations + /// Gets or sets the CountryRegionCode field. Mapped on target field 'CountryRegionCode'. + public System.String CountryRegionCode + { + get { return _countryRegionCode; } + set + { + if((_countryRegionCode != value)) + { + OnCountryRegionCodeChanging(value); + SendPropertyChanging("CountryRegionCode"); + _countryRegionCode = value; + SendPropertyChanged("CountryRegionCode"); + OnCountryRegionCodeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CountryRegionCurrency.CountryRegion - CountryRegion.CountryRegionCurrencies (m:1)' + public EntitySet CountryRegionCurrencies + { + get { return this._countryRegionCurrencies; } + set { this._countryRegionCurrencies.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritory.CountryRegion - CountryRegion.SalesTerritories (m:1)' + public EntitySet SalesTerritories + { + get { return this._salesTerritories; } + set { this._salesTerritories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'StateProvince.CountryRegion - CountryRegion.StateProvinces (m:1)' + public EntitySet StateProvinces + { + get { return this._stateProvinces; } + set { this._stateProvinces.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/CountryRegionCurrency.cs b/tests/AdventureWorks2008Model/EntityClasses/CountryRegionCurrency.cs new file mode 100644 index 0000000..f474e66 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/CountryRegionCurrency.cs @@ -0,0 +1,194 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'CountryRegionCurrency', mapped on table 'AdventureWorks.Sales.CountryRegionCurrency'. + public partial class CountryRegionCurrency : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _countryRegionCode; + private System.String _currencyCode; + private System.DateTime _modifiedDate; + private EntityRef _countryRegion; + private EntityRef _currency; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCountryRegionCodeChanging(System.String value); + partial void OnCountryRegionCodeChanged(); + partial void OnCurrencyCodeChanging(System.String value); + partial void OnCurrencyCodeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public CountryRegionCurrency() + { + _countryRegion = default(EntityRef); + _currency = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the CountryRegionCode field. Mapped on target field 'CountryRegionCode'. + public System.String CountryRegionCode + { + get { return _countryRegionCode; } + set + { + if((_countryRegionCode != value)) + { + if(_countryRegion.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCountryRegionCodeChanging(value); + SendPropertyChanging("CountryRegionCode"); + _countryRegionCode = value; + SendPropertyChanged("CountryRegionCode"); + OnCountryRegionCodeChanged(); + } + } + } + + /// Gets or sets the CurrencyCode field. Mapped on target field 'CurrencyCode'. + public System.String CurrencyCode + { + get { return _currencyCode; } + set + { + if((_currencyCode != value)) + { + if(_currency.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCurrencyCodeChanging(value); + SendPropertyChanging("CurrencyCode"); + _currencyCode = value; + SendPropertyChanged("CurrencyCode"); + OnCurrencyCodeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CountryRegionCurrency.CountryRegion - CountryRegion.CountryRegionCurrencies (m:1)' + public CountryRegion CountryRegion + { + get { return _countryRegion.Entity; } + set + { + CountryRegion previousValue = _countryRegion.Entity; + if((previousValue != value) || (_countryRegion.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CountryRegion"); + if(previousValue != null) + { + _countryRegion.Entity = null; + previousValue.CountryRegionCurrencies.Remove(this); + } + _countryRegion.Entity = value; + if(value == null) + { + _countryRegionCode = default(System.String); + } + else + { + value.CountryRegionCurrencies.Add(this); + _countryRegionCode = value.CountryRegionCode; + } + this.SendPropertyChanged("CountryRegion"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CountryRegionCurrency.Currency - Currency.CountryRegionCurrencies (m:1)' + public Currency Currency + { + get { return _currency.Entity; } + set + { + Currency previousValue = _currency.Entity; + if((previousValue != value) || (_currency.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Currency"); + if(previousValue != null) + { + _currency.Entity = null; + previousValue.CountryRegionCurrencies.Remove(this); + } + _currency.Entity = value; + if(value == null) + { + _currencyCode = default(System.String); + } + else + { + value.CountryRegionCurrencies.Add(this); + _currencyCode = value.CurrencyCode; + } + this.SendPropertyChanged("Currency"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/CreditCard.cs b/tests/AdventureWorks2008Model/EntityClasses/CreditCard.cs new file mode 100644 index 0000000..3c4258a --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/CreditCard.cs @@ -0,0 +1,232 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'CreditCard', mapped on table 'AdventureWorks.Sales.CreditCard'. + public partial class CreditCard : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _cardNumber; + private System.String _cardType; + private System.Int32 _creditCardId; + private System.Byte _expMonth; + private System.Int16 _expYear; + private System.DateTime _modifiedDate; + private EntitySet _personCreditCards; + private EntitySet _salesOrderHeaders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCardNumberChanging(System.String value); + partial void OnCardNumberChanged(); + partial void OnCardTypeChanging(System.String value); + partial void OnCardTypeChanged(); + partial void OnCreditCardIdChanging(System.Int32 value); + partial void OnCreditCardIdChanged(); + partial void OnExpMonthChanging(System.Byte value); + partial void OnExpMonthChanged(); + partial void OnExpYearChanging(System.Int16 value); + partial void OnExpYearChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public CreditCard() + { + _personCreditCards = new EntitySet(new Action(this.Attach_PersonCreditCards), new Action(this.Detach_PersonCreditCards) ); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PersonCreditCards(PersonCreditCard entity) + { + this.SendPropertyChanging("PersonCreditCards"); + entity.CreditCard = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PersonCreditCards(PersonCreditCard entity) + { + this.SendPropertyChanging("PersonCreditCards"); + entity.CreditCard = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.CreditCard = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.CreditCard = null; + } + + + #region Class Property Declarations + /// Gets or sets the CardNumber field. Mapped on target field 'CardNumber'. + public System.String CardNumber + { + get { return _cardNumber; } + set + { + if((_cardNumber != value)) + { + OnCardNumberChanging(value); + SendPropertyChanging("CardNumber"); + _cardNumber = value; + SendPropertyChanged("CardNumber"); + OnCardNumberChanged(); + } + } + } + + /// Gets or sets the CardType field. Mapped on target field 'CardType'. + public System.String CardType + { + get { return _cardType; } + set + { + if((_cardType != value)) + { + OnCardTypeChanging(value); + SendPropertyChanging("CardType"); + _cardType = value; + SendPropertyChanged("CardType"); + OnCardTypeChanged(); + } + } + } + + /// Gets or sets the CreditCardId field. Mapped on target field 'CreditCardID'. + public System.Int32 CreditCardId + { + get { return _creditCardId; } + set + { + if((_creditCardId != value)) + { + OnCreditCardIdChanging(value); + SendPropertyChanging("CreditCardId"); + _creditCardId = value; + SendPropertyChanged("CreditCardId"); + OnCreditCardIdChanged(); + } + } + } + + /// Gets or sets the ExpMonth field. Mapped on target field 'ExpMonth'. + public System.Byte ExpMonth + { + get { return _expMonth; } + set + { + if((_expMonth != value)) + { + OnExpMonthChanging(value); + SendPropertyChanging("ExpMonth"); + _expMonth = value; + SendPropertyChanged("ExpMonth"); + OnExpMonthChanged(); + } + } + } + + /// Gets or sets the ExpYear field. Mapped on target field 'ExpYear'. + public System.Int16 ExpYear + { + get { return _expYear; } + set + { + if((_expYear != value)) + { + OnExpYearChanging(value); + SendPropertyChanging("ExpYear"); + _expYear = value; + SendPropertyChanged("ExpYear"); + OnExpYearChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonCreditCard.CreditCard - CreditCard.PersonCreditCards (m:1)' + public EntitySet PersonCreditCards + { + get { return this._personCreditCards; } + set { this._personCreditCards.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.CreditCard - CreditCard.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Culture.cs b/tests/AdventureWorks2008Model/EntityClasses/Culture.cs new file mode 100644 index 0000000..044681a --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Culture.cs @@ -0,0 +1,147 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Culture', mapped on table 'AdventureWorks.Production.Culture'. + public partial class Culture : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _cultureId; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _productModelProductDescriptionCultures; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCultureIdChanging(System.String value); + partial void OnCultureIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public Culture() + { + _productModelProductDescriptionCultures = new EntitySet(new Action(this.Attach_ProductModelProductDescriptionCultures), new Action(this.Detach_ProductModelProductDescriptionCultures) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.Culture = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.Culture = null; + } + + + #region Class Property Declarations + /// Gets or sets the CultureId field. Mapped on target field 'CultureID'. + public System.String CultureId + { + get { return _cultureId; } + set + { + if((_cultureId != value)) + { + OnCultureIdChanging(value); + SendPropertyChanging("CultureId"); + _cultureId = value; + SendPropertyChanged("CultureId"); + OnCultureIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.Culture - Culture.ProductModelProductDescriptionCultures (m:1)' + public EntitySet ProductModelProductDescriptionCultures + { + get { return this._productModelProductDescriptionCultures; } + set { this._productModelProductDescriptionCultures.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Currency.cs b/tests/AdventureWorks2008Model/EntityClasses/Currency.cs new file mode 100644 index 0000000..17a5793 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Currency.cs @@ -0,0 +1,197 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Currency', mapped on table 'AdventureWorks.Sales.Currency'. + public partial class Currency : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _currencyCode; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _countryRegionCurrencies; + private EntitySet _currencyRates; + private EntitySet _currencyRates1; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCurrencyCodeChanging(System.String value); + partial void OnCurrencyCodeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public Currency() + { + _countryRegionCurrencies = new EntitySet(new Action(this.Attach_CountryRegionCurrencies), new Action(this.Detach_CountryRegionCurrencies) ); + _currencyRates = new EntitySet(new Action(this.Attach_CurrencyRates), new Action(this.Detach_CurrencyRates) ); + _currencyRates1 = new EntitySet(new Action(this.Attach_CurrencyRates1), new Action(this.Detach_CurrencyRates1) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_CountryRegionCurrencies(CountryRegionCurrency entity) + { + this.SendPropertyChanging("CountryRegionCurrencies"); + entity.Currency = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_CountryRegionCurrencies(CountryRegionCurrency entity) + { + this.SendPropertyChanging("CountryRegionCurrencies"); + entity.Currency = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_CurrencyRates(CurrencyRate entity) + { + this.SendPropertyChanging("CurrencyRates"); + entity.Currency = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_CurrencyRates(CurrencyRate entity) + { + this.SendPropertyChanging("CurrencyRates"); + entity.Currency = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_CurrencyRates1(CurrencyRate entity) + { + this.SendPropertyChanging("CurrencyRates1"); + entity.Currency1 = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_CurrencyRates1(CurrencyRate entity) + { + this.SendPropertyChanging("CurrencyRates1"); + entity.Currency1 = null; + } + + + #region Class Property Declarations + /// Gets or sets the CurrencyCode field. Mapped on target field 'CurrencyCode'. + public System.String CurrencyCode + { + get { return _currencyCode; } + set + { + if((_currencyCode != value)) + { + OnCurrencyCodeChanging(value); + SendPropertyChanging("CurrencyCode"); + _currencyCode = value; + SendPropertyChanged("CurrencyCode"); + OnCurrencyCodeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CountryRegionCurrency.Currency - Currency.CountryRegionCurrencies (m:1)' + public EntitySet CountryRegionCurrencies + { + get { return this._countryRegionCurrencies; } + set { this._countryRegionCurrencies.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'CurrencyRate.Currency - Currency.CurrencyRates (m:1)' + public EntitySet CurrencyRates + { + get { return this._currencyRates; } + set { this._currencyRates.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'CurrencyRate.Currency1 - Currency.CurrencyRates1 (m:1)' + public EntitySet CurrencyRates1 + { + get { return this._currencyRates1; } + set { this._currencyRates1.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/CurrencyRate.cs b/tests/AdventureWorks2008Model/EntityClasses/CurrencyRate.cs new file mode 100644 index 0000000..4053845 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/CurrencyRate.cs @@ -0,0 +1,299 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'CurrencyRate', mapped on table 'AdventureWorks.Sales.CurrencyRate'. + public partial class CurrencyRate : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _averageRate; + private System.DateTime _currencyRateDate; + private System.Int32 _currencyRateId; + private System.Decimal _endOfDayRate; + private System.String _fromCurrencyCode; + private System.DateTime _modifiedDate; + private System.String _toCurrencyCode; + private EntityRef _currency; + private EntityRef _currency1; + private EntitySet _salesOrderHeaders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAverageRateChanging(System.Decimal value); + partial void OnAverageRateChanged(); + partial void OnCurrencyRateDateChanging(System.DateTime value); + partial void OnCurrencyRateDateChanged(); + partial void OnCurrencyRateIdChanging(System.Int32 value); + partial void OnCurrencyRateIdChanged(); + partial void OnEndOfDayRateChanging(System.Decimal value); + partial void OnEndOfDayRateChanged(); + partial void OnFromCurrencyCodeChanging(System.String value); + partial void OnFromCurrencyCodeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnToCurrencyCodeChanging(System.String value); + partial void OnToCurrencyCodeChanged(); + #endregion + + /// Initializes a new instance of the class. + public CurrencyRate() + { + _currency = default(EntityRef); + _currency1 = default(EntityRef); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.CurrencyRate = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.CurrencyRate = null; + } + + + #region Class Property Declarations + /// Gets or sets the AverageRate field. Mapped on target field 'AverageRate'. + public System.Decimal AverageRate + { + get { return _averageRate; } + set + { + if((_averageRate != value)) + { + OnAverageRateChanging(value); + SendPropertyChanging("AverageRate"); + _averageRate = value; + SendPropertyChanged("AverageRate"); + OnAverageRateChanged(); + } + } + } + + /// Gets or sets the CurrencyRateDate field. Mapped on target field 'CurrencyRateDate'. + public System.DateTime CurrencyRateDate + { + get { return _currencyRateDate; } + set + { + if((_currencyRateDate != value)) + { + OnCurrencyRateDateChanging(value); + SendPropertyChanging("CurrencyRateDate"); + _currencyRateDate = value; + SendPropertyChanged("CurrencyRateDate"); + OnCurrencyRateDateChanged(); + } + } + } + + /// Gets or sets the CurrencyRateId field. Mapped on target field 'CurrencyRateID'. + public System.Int32 CurrencyRateId + { + get { return _currencyRateId; } + set + { + if((_currencyRateId != value)) + { + OnCurrencyRateIdChanging(value); + SendPropertyChanging("CurrencyRateId"); + _currencyRateId = value; + SendPropertyChanged("CurrencyRateId"); + OnCurrencyRateIdChanged(); + } + } + } + + /// Gets or sets the EndOfDayRate field. Mapped on target field 'EndOfDayRate'. + public System.Decimal EndOfDayRate + { + get { return _endOfDayRate; } + set + { + if((_endOfDayRate != value)) + { + OnEndOfDayRateChanging(value); + SendPropertyChanging("EndOfDayRate"); + _endOfDayRate = value; + SendPropertyChanged("EndOfDayRate"); + OnEndOfDayRateChanged(); + } + } + } + + /// Gets or sets the FromCurrencyCode field. Mapped on target field 'FromCurrencyCode'. + public System.String FromCurrencyCode + { + get { return _fromCurrencyCode; } + set + { + if((_fromCurrencyCode != value)) + { + if(_currency.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnFromCurrencyCodeChanging(value); + SendPropertyChanging("FromCurrencyCode"); + _fromCurrencyCode = value; + SendPropertyChanged("FromCurrencyCode"); + OnFromCurrencyCodeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ToCurrencyCode field. Mapped on target field 'ToCurrencyCode'. + public System.String ToCurrencyCode + { + get { return _toCurrencyCode; } + set + { + if((_toCurrencyCode != value)) + { + if(_currency1.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnToCurrencyCodeChanging(value); + SendPropertyChanging("ToCurrencyCode"); + _toCurrencyCode = value; + SendPropertyChanged("ToCurrencyCode"); + OnToCurrencyCodeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CurrencyRate.Currency - Currency.CurrencyRates (m:1)' + public Currency Currency + { + get { return _currency.Entity; } + set + { + Currency previousValue = _currency.Entity; + if((previousValue != value) || (_currency.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Currency"); + if(previousValue != null) + { + _currency.Entity = null; + previousValue.CurrencyRates.Remove(this); + } + _currency.Entity = value; + if(value == null) + { + _fromCurrencyCode = default(System.String); + } + else + { + value.CurrencyRates.Add(this); + _fromCurrencyCode = value.CurrencyCode; + } + this.SendPropertyChanged("Currency"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'CurrencyRate.Currency1 - Currency.CurrencyRates1 (m:1)' + public Currency Currency1 + { + get { return _currency1.Entity; } + set + { + Currency previousValue = _currency1.Entity; + if((previousValue != value) || (_currency1.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Currency1"); + if(previousValue != null) + { + _currency1.Entity = null; + previousValue.CurrencyRates1.Remove(this); + } + _currency1.Entity = value; + if(value == null) + { + _toCurrencyCode = default(System.String); + } + else + { + value.CurrencyRates1.Add(this); + _toCurrencyCode = value.CurrencyCode; + } + this.SendPropertyChanged("Currency1"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.CurrencyRate - CurrencyRate.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Customer.cs b/tests/AdventureWorks2008Model/EntityClasses/Customer.cs new file mode 100644 index 0000000..59a5c48 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Customer.cs @@ -0,0 +1,324 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Customer', mapped on table 'AdventureWorks.Sales.Customer'. + public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _accountNumber; + private System.Int32 _customerId; + private System.DateTime _modifiedDate; + private Nullable _personId; + private System.Guid _rowguid; + private Nullable _storeId; + private Nullable _territoryId; + private EntityRef _person; + private EntitySet _salesOrderHeaders; + private EntityRef _salesTerritory; + private EntityRef _store; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAccountNumberChanging(System.String value); + partial void OnAccountNumberChanged(); + partial void OnCustomerIdChanging(System.Int32 value); + partial void OnCustomerIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPersonIdChanging(Nullable value); + partial void OnPersonIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnStoreIdChanging(Nullable value); + partial void OnStoreIdChanged(); + partial void OnTerritoryIdChanging(Nullable value); + partial void OnTerritoryIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public Customer() + { + _person = default(EntityRef); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + _salesTerritory = default(EntityRef); + _store = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.Customer = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.Customer = null; + } + + + #region Class Property Declarations + /// Gets or sets the AccountNumber field. Mapped on target field 'AccountNumber'. + public System.String AccountNumber + { + get { return _accountNumber; } + } + + /// Gets or sets the CustomerId field. Mapped on target field 'CustomerID'. + public System.Int32 CustomerId + { + get { return _customerId; } + set + { + if((_customerId != value)) + { + OnCustomerIdChanging(value); + SendPropertyChanging("CustomerId"); + _customerId = value; + SendPropertyChanged("CustomerId"); + OnCustomerIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PersonId field. Mapped on target field 'PersonID'. + public Nullable PersonId + { + get { return _personId; } + set + { + if((_personId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnPersonIdChanging(value); + SendPropertyChanging("PersonId"); + _personId = value; + SendPropertyChanged("PersonId"); + OnPersonIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the StoreId field. Mapped on target field 'StoreID'. + public Nullable StoreId + { + get { return _storeId; } + set + { + if((_storeId != value)) + { + if(_store.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnStoreIdChanging(value); + SendPropertyChanging("StoreId"); + _storeId = value; + SendPropertyChanged("StoreId"); + OnStoreIdChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public Nullable TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + if(_salesTerritory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Customer.Person - Person.Customers (m:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.Customers.Remove(this); + } + _person.Entity = value; + if(value == null) + { + _personId = default(Nullable); + } + else + { + value.Customers.Add(this); + _personId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Customer - Customer.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Customer.SalesTerritory - SalesTerritory.Customers (m:1)' + public SalesTerritory SalesTerritory + { + get { return _salesTerritory.Entity; } + set + { + SalesTerritory previousValue = _salesTerritory.Entity; + if((previousValue != value) || (_salesTerritory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesTerritory"); + if(previousValue != null) + { + _salesTerritory.Entity = null; + previousValue.Customers.Remove(this); + } + _salesTerritory.Entity = value; + if(value == null) + { + _territoryId = default(Nullable); + } + else + { + value.Customers.Add(this); + _territoryId = value.TerritoryId; + } + this.SendPropertyChanged("SalesTerritory"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Customer.Store - Store.Customers (m:1)' + public Store Store + { + get { return _store.Entity; } + set + { + Store previousValue = _store.Entity; + if((previousValue != value) || (_store.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Store"); + if(previousValue != null) + { + _store.Entity = null; + previousValue.Customers.Remove(this); + } + _store.Entity = value; + if(value == null) + { + _storeId = default(Nullable); + } + else + { + value.Customers.Add(this); + _storeId = value.BusinessEntityId; + } + this.SendPropertyChanged("Store"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/DatabaseLog.cs b/tests/AdventureWorks2008Model/EntityClasses/DatabaseLog.cs new file mode 100644 index 0000000..b4c3a75 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/DatabaseLog.cs @@ -0,0 +1,222 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'DatabaseLog', mapped on table 'AdventureWorks.dbo.DatabaseLog'. + public partial class DatabaseLog : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _databaseLogId; + private System.String _databaseUser; + private System.String _event; + private System.String _object; + private System.DateTime _postTime; + private System.String _schema; + private System.String _tsql; + private System.String _xmlEvent; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDatabaseLogIdChanging(System.Int32 value); + partial void OnDatabaseLogIdChanged(); + partial void OnDatabaseUserChanging(System.String value); + partial void OnDatabaseUserChanged(); + partial void OnEventChanging(System.String value); + partial void OnEventChanged(); + partial void OnObjectChanging(System.String value); + partial void OnObjectChanged(); + partial void OnPostTimeChanging(System.DateTime value); + partial void OnPostTimeChanged(); + partial void OnSchemaChanging(System.String value); + partial void OnSchemaChanged(); + partial void OnTsqlChanging(System.String value); + partial void OnTsqlChanged(); + partial void OnXmlEventChanging(System.String value); + partial void OnXmlEventChanged(); + #endregion + + /// Initializes a new instance of the class. + public DatabaseLog() + { + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the DatabaseLogId field. Mapped on target field 'DatabaseLogID'. + public System.Int32 DatabaseLogId + { + get { return _databaseLogId; } + set + { + if((_databaseLogId != value)) + { + OnDatabaseLogIdChanging(value); + SendPropertyChanging("DatabaseLogId"); + _databaseLogId = value; + SendPropertyChanged("DatabaseLogId"); + OnDatabaseLogIdChanged(); + } + } + } + + /// Gets or sets the DatabaseUser field. Mapped on target field 'DatabaseUser'. + public System.String DatabaseUser + { + get { return _databaseUser; } + set + { + if((_databaseUser != value)) + { + OnDatabaseUserChanging(value); + SendPropertyChanging("DatabaseUser"); + _databaseUser = value; + SendPropertyChanged("DatabaseUser"); + OnDatabaseUserChanged(); + } + } + } + + /// Gets or sets the Event field. Mapped on target field 'Event'. + public System.String Event + { + get { return _event; } + set + { + if((_event != value)) + { + OnEventChanging(value); + SendPropertyChanging("Event"); + _event = value; + SendPropertyChanged("Event"); + OnEventChanged(); + } + } + } + + /// Gets or sets the Object field. Mapped on target field 'Object'. + public System.String Object + { + get { return _object; } + set + { + if((_object != value)) + { + OnObjectChanging(value); + SendPropertyChanging("Object"); + _object = value; + SendPropertyChanged("Object"); + OnObjectChanged(); + } + } + } + + /// Gets or sets the PostTime field. Mapped on target field 'PostTime'. + public System.DateTime PostTime + { + get { return _postTime; } + set + { + if((_postTime != value)) + { + OnPostTimeChanging(value); + SendPropertyChanging("PostTime"); + _postTime = value; + SendPropertyChanged("PostTime"); + OnPostTimeChanged(); + } + } + } + + /// Gets or sets the Schema field. Mapped on target field 'Schema'. + public System.String Schema + { + get { return _schema; } + set + { + if((_schema != value)) + { + OnSchemaChanging(value); + SendPropertyChanging("Schema"); + _schema = value; + SendPropertyChanged("Schema"); + OnSchemaChanged(); + } + } + } + + /// Gets or sets the Tsql field. Mapped on target field 'TSQL'. + public System.String Tsql + { + get { return _tsql; } + set + { + if((_tsql != value)) + { + OnTsqlChanging(value); + SendPropertyChanging("Tsql"); + _tsql = value; + SendPropertyChanged("Tsql"); + OnTsqlChanged(); + } + } + } + + /// Gets or sets the XmlEvent field. Mapped on target field 'XmlEvent'. + public System.String XmlEvent + { + get { return _xmlEvent; } + set + { + if((_xmlEvent != value)) + { + OnXmlEventChanging(value); + SendPropertyChanging("XmlEvent"); + _xmlEvent = value; + SendPropertyChanged("XmlEvent"); + OnXmlEventChanged(); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Department.cs b/tests/AdventureWorks2008Model/EntityClasses/Department.cs new file mode 100644 index 0000000..38b38ad --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Department.cs @@ -0,0 +1,167 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Department', mapped on table 'AdventureWorks.HumanResources.Department'. + public partial class Department : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int16 _departmentId; + private System.String _groupName; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _employeeDepartmentHistories; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDepartmentIdChanging(System.Int16 value); + partial void OnDepartmentIdChanged(); + partial void OnGroupNameChanging(System.String value); + partial void OnGroupNameChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public Department() + { + _employeeDepartmentHistories = new EntitySet(new Action(this.Attach_EmployeeDepartmentHistories), new Action(this.Detach_EmployeeDepartmentHistories) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Department = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Department = null; + } + + + #region Class Property Declarations + /// Gets or sets the DepartmentId field. Mapped on target field 'DepartmentID'. + public System.Int16 DepartmentId + { + get { return _departmentId; } + set + { + if((_departmentId != value)) + { + OnDepartmentIdChanging(value); + SendPropertyChanging("DepartmentId"); + _departmentId = value; + SendPropertyChanged("DepartmentId"); + OnDepartmentIdChanged(); + } + } + } + + /// Gets or sets the GroupName field. Mapped on target field 'GroupName'. + public System.String GroupName + { + get { return _groupName; } + set + { + if((_groupName != value)) + { + OnGroupNameChanging(value); + SendPropertyChanging("GroupName"); + _groupName = value; + SendPropertyChanged("GroupName"); + OnGroupNameChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Department - Department.EmployeeDepartmentHistories (m:1)' + public EntitySet EmployeeDepartmentHistories + { + get { return this._employeeDepartmentHistories; } + set { this._employeeDepartmentHistories.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Document.cs b/tests/AdventureWorks2008Model/EntityClasses/Document.cs new file mode 100644 index 0000000..290f24f --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Document.cs @@ -0,0 +1,392 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Document', mapped on table 'AdventureWorks.Production.Document'. + public partial class Document : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _changeNumber; + private System.Data.Linq.Binary _documentData; + private Nullable _documentLevel; + private System.String _documentNode; + private System.String _documentSummary; + private System.String _fileExtension; + private System.String _fileName; + private System.Boolean _folderFlag; + private System.DateTime _modifiedDate; + private System.Int32 _owner; + private System.String _revision; + private System.Guid _rowguid; + private System.Byte _status; + private System.String _title; + private EntityRef _employee; + private EntitySet _productDocuments; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnChangeNumberChanging(System.Int32 value); + partial void OnChangeNumberChanged(); + partial void OnDocumentDataChanging(System.Data.Linq.Binary value); + partial void OnDocumentDataChanged(); + partial void OnDocumentLevelChanging(Nullable value); + partial void OnDocumentLevelChanged(); + partial void OnDocumentNodeChanging(System.String value); + partial void OnDocumentNodeChanged(); + partial void OnDocumentSummaryChanging(System.String value); + partial void OnDocumentSummaryChanged(); + partial void OnFileExtensionChanging(System.String value); + partial void OnFileExtensionChanged(); + partial void OnFileNameChanging(System.String value); + partial void OnFileNameChanged(); + partial void OnFolderFlagChanging(System.Boolean value); + partial void OnFolderFlagChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOwnerChanging(System.Int32 value); + partial void OnOwnerChanged(); + partial void OnRevisionChanging(System.String value); + partial void OnRevisionChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnStatusChanging(System.Byte value); + partial void OnStatusChanged(); + partial void OnTitleChanging(System.String value); + partial void OnTitleChanged(); + #endregion + + /// Initializes a new instance of the class. + public Document() + { + _employee = default(EntityRef); + _productDocuments = new EntitySet(new Action(this.Attach_ProductDocuments), new Action(this.Detach_ProductDocuments) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductDocuments(ProductDocument entity) + { + this.SendPropertyChanging("ProductDocuments"); + entity.Document = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductDocuments(ProductDocument entity) + { + this.SendPropertyChanging("ProductDocuments"); + entity.Document = null; + } + + + #region Class Property Declarations + /// Gets or sets the ChangeNumber field. Mapped on target field 'ChangeNumber'. + public System.Int32 ChangeNumber + { + get { return _changeNumber; } + set + { + if((_changeNumber != value)) + { + OnChangeNumberChanging(value); + SendPropertyChanging("ChangeNumber"); + _changeNumber = value; + SendPropertyChanged("ChangeNumber"); + OnChangeNumberChanged(); + } + } + } + + /// Gets or sets the DocumentData field. Mapped on target field 'Document'. + public System.Data.Linq.Binary DocumentData + { + get { return _documentData; } + set + { + if((_documentData != value)) + { + OnDocumentDataChanging(value); + SendPropertyChanging("DocumentData"); + _documentData = value; + SendPropertyChanged("DocumentData"); + OnDocumentDataChanged(); + } + } + } + + /// Gets or sets the DocumentLevel field. Mapped on target field 'DocumentLevel'. + public Nullable DocumentLevel + { + get { return _documentLevel; } + } + + /// Gets or sets the DocumentNode field. Mapped on target field 'DocumentNode'. + public System.String DocumentNode + { + get { return _documentNode; } + set + { + if((_documentNode != value)) + { + OnDocumentNodeChanging(value); + SendPropertyChanging("DocumentNode"); + _documentNode = value; + SendPropertyChanged("DocumentNode"); + OnDocumentNodeChanged(); + } + } + } + + /// Gets or sets the DocumentSummary field. Mapped on target field 'DocumentSummary'. + public System.String DocumentSummary + { + get { return _documentSummary; } + set + { + if((_documentSummary != value)) + { + OnDocumentSummaryChanging(value); + SendPropertyChanging("DocumentSummary"); + _documentSummary = value; + SendPropertyChanged("DocumentSummary"); + OnDocumentSummaryChanged(); + } + } + } + + /// Gets or sets the FileExtension field. Mapped on target field 'FileExtension'. + public System.String FileExtension + { + get { return _fileExtension; } + set + { + if((_fileExtension != value)) + { + OnFileExtensionChanging(value); + SendPropertyChanging("FileExtension"); + _fileExtension = value; + SendPropertyChanged("FileExtension"); + OnFileExtensionChanged(); + } + } + } + + /// Gets or sets the FileName field. Mapped on target field 'FileName'. + public System.String FileName + { + get { return _fileName; } + set + { + if((_fileName != value)) + { + OnFileNameChanging(value); + SendPropertyChanging("FileName"); + _fileName = value; + SendPropertyChanged("FileName"); + OnFileNameChanged(); + } + } + } + + /// Gets or sets the FolderFlag field. Mapped on target field 'FolderFlag'. + public System.Boolean FolderFlag + { + get { return _folderFlag; } + set + { + if((_folderFlag != value)) + { + OnFolderFlagChanging(value); + SendPropertyChanging("FolderFlag"); + _folderFlag = value; + SendPropertyChanged("FolderFlag"); + OnFolderFlagChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Owner field. Mapped on target field 'Owner'. + public System.Int32 Owner + { + get { return _owner; } + set + { + if((_owner != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnOwnerChanging(value); + SendPropertyChanging("Owner"); + _owner = value; + SendPropertyChanged("Owner"); + OnOwnerChanged(); + } + } + } + + /// Gets or sets the Revision field. Mapped on target field 'Revision'. + public System.String Revision + { + get { return _revision; } + set + { + if((_revision != value)) + { + OnRevisionChanging(value); + SendPropertyChanging("Revision"); + _revision = value; + SendPropertyChanged("Revision"); + OnRevisionChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the Status field. Mapped on target field 'Status'. + public System.Byte Status + { + get { return _status; } + set + { + if((_status != value)) + { + OnStatusChanging(value); + SendPropertyChanging("Status"); + _status = value; + SendPropertyChanged("Status"); + OnStatusChanged(); + } + } + } + + /// Gets or sets the Title field. Mapped on target field 'Title'. + public System.String Title + { + get { return _title; } + set + { + if((_title != value)) + { + OnTitleChanging(value); + SendPropertyChanging("Title"); + _title = value; + SendPropertyChanged("Title"); + OnTitleChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Document.Employee - Employee.Documents (m:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.Documents.Remove(this); + } + _employee.Entity = value; + if(value == null) + { + _owner = default(System.Int32); + } + else + { + value.Documents.Add(this); + _owner = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductDocument.Document - Document.ProductDocuments (m:1)' + public EntitySet ProductDocuments + { + get { return this._productDocuments; } + set { this._productDocuments.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/EmailAddress.cs b/tests/AdventureWorks2008Model/EntityClasses/EmailAddress.cs new file mode 100644 index 0000000..d4dc46e --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/EmailAddress.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'EmailAddress', mapped on table 'AdventureWorks.Person.EmailAddress'. + public partial class EmailAddress : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.String _emailAddressData; + private System.Int32 _emailAddressId; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private EntityRef _person; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnEmailAddressDataChanging(System.String value); + partial void OnEmailAddressDataChanged(); + partial void OnEmailAddressIdChanging(System.Int32 value); + partial void OnEmailAddressIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public EmailAddress() + { + _person = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the EmailAddressData field. Mapped on target field 'EmailAddress'. + public System.String EmailAddressData + { + get { return _emailAddressData; } + set + { + if((_emailAddressData != value)) + { + OnEmailAddressDataChanging(value); + SendPropertyChanging("EmailAddressData"); + _emailAddressData = value; + SendPropertyChanged("EmailAddressData"); + OnEmailAddressDataChanged(); + } + } + } + + /// Gets or sets the EmailAddressId field. Mapped on target field 'EmailAddressID'. + public System.Int32 EmailAddressId + { + get { return _emailAddressId; } + set + { + if((_emailAddressId != value)) + { + OnEmailAddressIdChanging(value); + SendPropertyChanging("EmailAddressId"); + _emailAddressId = value; + SendPropertyChanged("EmailAddressId"); + OnEmailAddressIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmailAddress.Person - Person.EmailAddresses (m:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.EmailAddresses.Remove(this); + } + _person.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.EmailAddresses.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Employee.cs b/tests/AdventureWorks2008Model/EntityClasses/Employee.cs new file mode 100644 index 0000000..a6fb358 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Employee.cs @@ -0,0 +1,559 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Employee', mapped on table 'AdventureWorks.HumanResources.Employee'. + public partial class Employee : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _birthDate; + private System.Int32 _businessEntityId; + private System.Boolean _currentFlag; + private System.String _gender; + private System.DateTime _hireDate; + private System.String _jobTitle; + private System.String _loginId; + private System.String _maritalStatus; + private System.DateTime _modifiedDate; + private System.String _nationalIdnumber; + private Nullable _organizationLevel; + private System.String _organizationNode; + private System.Guid _rowguid; + private System.Boolean _salariedFlag; + private System.Int16 _sickLeaveHours; + private System.Int16 _vacationHours; + private EntitySet _documents; + private EntitySet _employeeDepartmentHistories; + private EntitySet _employeePayHistories; + private EntitySet _jobCandidates; + private EntityRef _person; + private EntitySet _purchaseOrderHeaders; + private EntityRef _salesPerson; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBirthDateChanging(System.DateTime value); + partial void OnBirthDateChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnCurrentFlagChanging(System.Boolean value); + partial void OnCurrentFlagChanged(); + partial void OnGenderChanging(System.String value); + partial void OnGenderChanged(); + partial void OnHireDateChanging(System.DateTime value); + partial void OnHireDateChanged(); + partial void OnJobTitleChanging(System.String value); + partial void OnJobTitleChanged(); + partial void OnLoginIdChanging(System.String value); + partial void OnLoginIdChanged(); + partial void OnMaritalStatusChanging(System.String value); + partial void OnMaritalStatusChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNationalIdnumberChanging(System.String value); + partial void OnNationalIdnumberChanged(); + partial void OnOrganizationLevelChanging(Nullable value); + partial void OnOrganizationLevelChanged(); + partial void OnOrganizationNodeChanging(System.String value); + partial void OnOrganizationNodeChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalariedFlagChanging(System.Boolean value); + partial void OnSalariedFlagChanged(); + partial void OnSickLeaveHoursChanging(System.Int16 value); + partial void OnSickLeaveHoursChanged(); + partial void OnVacationHoursChanging(System.Int16 value); + partial void OnVacationHoursChanged(); + #endregion + + /// Initializes a new instance of the class. + public Employee() + { + _documents = new EntitySet(new Action(this.Attach_Documents), new Action(this.Detach_Documents) ); + _employeeDepartmentHistories = new EntitySet(new Action(this.Attach_EmployeeDepartmentHistories), new Action(this.Detach_EmployeeDepartmentHistories) ); + _employeePayHistories = new EntitySet(new Action(this.Attach_EmployeePayHistories), new Action(this.Detach_EmployeePayHistories) ); + _jobCandidates = new EntitySet(new Action(this.Attach_JobCandidates), new Action(this.Detach_JobCandidates) ); + _person = default(EntityRef); + _purchaseOrderHeaders = new EntitySet(new Action(this.Attach_PurchaseOrderHeaders), new Action(this.Detach_PurchaseOrderHeaders) ); + _salesPerson = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Documents(Document entity) + { + this.SendPropertyChanging("Documents"); + entity.Employee = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Documents(Document entity) + { + this.SendPropertyChanging("Documents"); + entity.Employee = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Employee = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Employee = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_EmployeePayHistories(EmployeePayHistory entity) + { + this.SendPropertyChanging("EmployeePayHistories"); + entity.Employee = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_EmployeePayHistories(EmployeePayHistory entity) + { + this.SendPropertyChanging("EmployeePayHistories"); + entity.Employee = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_JobCandidates(JobCandidate entity) + { + this.SendPropertyChanging("JobCandidates"); + entity.Employee = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_JobCandidates(JobCandidate entity) + { + this.SendPropertyChanging("JobCandidates"); + entity.Employee = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.Employee = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.Employee = null; + } + + + #region Class Property Declarations + /// Gets or sets the BirthDate field. Mapped on target field 'BirthDate'. + public System.DateTime BirthDate + { + get { return _birthDate; } + set + { + if((_birthDate != value)) + { + OnBirthDateChanging(value); + SendPropertyChanging("BirthDate"); + _birthDate = value; + SendPropertyChanged("BirthDate"); + OnBirthDateChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the CurrentFlag field. Mapped on target field 'CurrentFlag'. + public System.Boolean CurrentFlag + { + get { return _currentFlag; } + set + { + if((_currentFlag != value)) + { + OnCurrentFlagChanging(value); + SendPropertyChanging("CurrentFlag"); + _currentFlag = value; + SendPropertyChanged("CurrentFlag"); + OnCurrentFlagChanged(); + } + } + } + + /// Gets or sets the Gender field. Mapped on target field 'Gender'. + public System.String Gender + { + get { return _gender; } + set + { + if((_gender != value)) + { + OnGenderChanging(value); + SendPropertyChanging("Gender"); + _gender = value; + SendPropertyChanged("Gender"); + OnGenderChanged(); + } + } + } + + /// Gets or sets the HireDate field. Mapped on target field 'HireDate'. + public System.DateTime HireDate + { + get { return _hireDate; } + set + { + if((_hireDate != value)) + { + OnHireDateChanging(value); + SendPropertyChanging("HireDate"); + _hireDate = value; + SendPropertyChanged("HireDate"); + OnHireDateChanged(); + } + } + } + + /// Gets or sets the JobTitle field. Mapped on target field 'JobTitle'. + public System.String JobTitle + { + get { return _jobTitle; } + set + { + if((_jobTitle != value)) + { + OnJobTitleChanging(value); + SendPropertyChanging("JobTitle"); + _jobTitle = value; + SendPropertyChanged("JobTitle"); + OnJobTitleChanged(); + } + } + } + + /// Gets or sets the LoginId field. Mapped on target field 'LoginID'. + public System.String LoginId + { + get { return _loginId; } + set + { + if((_loginId != value)) + { + OnLoginIdChanging(value); + SendPropertyChanging("LoginId"); + _loginId = value; + SendPropertyChanged("LoginId"); + OnLoginIdChanged(); + } + } + } + + /// Gets or sets the MaritalStatus field. Mapped on target field 'MaritalStatus'. + public System.String MaritalStatus + { + get { return _maritalStatus; } + set + { + if((_maritalStatus != value)) + { + OnMaritalStatusChanging(value); + SendPropertyChanging("MaritalStatus"); + _maritalStatus = value; + SendPropertyChanged("MaritalStatus"); + OnMaritalStatusChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the NationalIdnumber field. Mapped on target field 'NationalIDNumber'. + public System.String NationalIdnumber + { + get { return _nationalIdnumber; } + set + { + if((_nationalIdnumber != value)) + { + OnNationalIdnumberChanging(value); + SendPropertyChanging("NationalIdnumber"); + _nationalIdnumber = value; + SendPropertyChanged("NationalIdnumber"); + OnNationalIdnumberChanged(); + } + } + } + + /// Gets or sets the OrganizationLevel field. Mapped on target field 'OrganizationLevel'. + public Nullable OrganizationLevel + { + get { return _organizationLevel; } + } + + /// Gets or sets the OrganizationNode field. Mapped on target field 'OrganizationNode'. + public System.String OrganizationNode + { + get { return _organizationNode; } + set + { + if((_organizationNode != value)) + { + OnOrganizationNodeChanging(value); + SendPropertyChanging("OrganizationNode"); + _organizationNode = value; + SendPropertyChanged("OrganizationNode"); + OnOrganizationNodeChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalariedFlag field. Mapped on target field 'SalariedFlag'. + public System.Boolean SalariedFlag + { + get { return _salariedFlag; } + set + { + if((_salariedFlag != value)) + { + OnSalariedFlagChanging(value); + SendPropertyChanging("SalariedFlag"); + _salariedFlag = value; + SendPropertyChanged("SalariedFlag"); + OnSalariedFlagChanged(); + } + } + } + + /// Gets or sets the SickLeaveHours field. Mapped on target field 'SickLeaveHours'. + public System.Int16 SickLeaveHours + { + get { return _sickLeaveHours; } + set + { + if((_sickLeaveHours != value)) + { + OnSickLeaveHoursChanging(value); + SendPropertyChanging("SickLeaveHours"); + _sickLeaveHours = value; + SendPropertyChanged("SickLeaveHours"); + OnSickLeaveHoursChanged(); + } + } + } + + /// Gets or sets the VacationHours field. Mapped on target field 'VacationHours'. + public System.Int16 VacationHours + { + get { return _vacationHours; } + set + { + if((_vacationHours != value)) + { + OnVacationHoursChanging(value); + SendPropertyChanging("VacationHours"); + _vacationHours = value; + SendPropertyChanged("VacationHours"); + OnVacationHoursChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Document.Employee - Employee.Documents (m:1)' + public EntitySet Documents + { + get { return this._documents; } + set { this._documents.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Employee - Employee.EmployeeDepartmentHistories (m:1)' + public EntitySet EmployeeDepartmentHistories + { + get { return this._employeeDepartmentHistories; } + set { this._employeeDepartmentHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'EmployeePayHistory.Employee - Employee.EmployeePayHistories (m:1)' + public EntitySet EmployeePayHistories + { + get { return this._employeePayHistories; } + set { this._employeePayHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'JobCandidate.Employee - Employee.JobCandidates (m:1)' + public EntitySet JobCandidates + { + get { return this._jobCandidates; } + set { this._jobCandidates.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Employee.Person - Person.Employee (1:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.Employee=null; + } + _person.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.Employee = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.Employee - Employee.PurchaseOrderHeaders (m:1)' + public EntitySet PurchaseOrderHeaders + { + get { return this._purchaseOrderHeaders; } + set { this._purchaseOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesPerson.Employee - Employee.SalesPerson (1:1)' + public SalesPerson SalesPerson + { + get { return _salesPerson.Entity; } + set + { + SalesPerson previousValue = _salesPerson.Entity; + if((previousValue != value) || (_salesPerson.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesPerson"); + if(previousValue != null) + { + _salesPerson.Entity = null; + previousValue.Employee=null; + } + _salesPerson.Entity = value; + if(value != null) + { + value.Employee = this; + } + this.SendPropertyChanged("SalesPerson"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/EmployeeDepartmentHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/EmployeeDepartmentHistory.cs new file mode 100644 index 0000000..4f2cada --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/EmployeeDepartmentHistory.cs @@ -0,0 +1,290 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'EmployeeDepartmentHistory', mapped on table 'AdventureWorks.HumanResources.EmployeeDepartmentHistory'. + public partial class EmployeeDepartmentHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.Int16 _departmentId; + private Nullable _endDate; + private System.DateTime _modifiedDate; + private System.Byte _shiftId; + private System.DateTime _startDate; + private EntityRef _department; + private EntityRef _employee; + private EntityRef _shift; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnDepartmentIdChanging(System.Int16 value); + partial void OnDepartmentIdChanged(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnShiftIdChanging(System.Byte value); + partial void OnShiftIdChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public EmployeeDepartmentHistory() + { + _department = default(EntityRef); + _employee = default(EntityRef); + _shift = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the DepartmentId field. Mapped on target field 'DepartmentID'. + public System.Int16 DepartmentId + { + get { return _departmentId; } + set + { + if((_departmentId != value)) + { + if(_department.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnDepartmentIdChanging(value); + SendPropertyChanging("DepartmentId"); + _departmentId = value; + SendPropertyChanged("DepartmentId"); + OnDepartmentIdChanged(); + } + } + } + + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ShiftId field. Mapped on target field 'ShiftID'. + public System.Byte ShiftId + { + get { return _shiftId; } + set + { + if((_shiftId != value)) + { + if(_shift.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnShiftIdChanging(value); + SendPropertyChanging("ShiftId"); + _shiftId = value; + SendPropertyChanged("ShiftId"); + OnShiftIdChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Department - Department.EmployeeDepartmentHistories (m:1)' + public Department Department + { + get { return _department.Entity; } + set + { + Department previousValue = _department.Entity; + if((previousValue != value) || (_department.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Department"); + if(previousValue != null) + { + _department.Entity = null; + previousValue.EmployeeDepartmentHistories.Remove(this); + } + _department.Entity = value; + if(value == null) + { + _departmentId = default(System.Int16); + } + else + { + value.EmployeeDepartmentHistories.Add(this); + _departmentId = value.DepartmentId; + } + this.SendPropertyChanged("Department"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Employee - Employee.EmployeeDepartmentHistories (m:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.EmployeeDepartmentHistories.Remove(this); + } + _employee.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.EmployeeDepartmentHistories.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Shift - Shift.EmployeeDepartmentHistories (m:1)' + public Shift Shift + { + get { return _shift.Entity; } + set + { + Shift previousValue = _shift.Entity; + if((previousValue != value) || (_shift.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Shift"); + if(previousValue != null) + { + _shift.Entity = null; + previousValue.EmployeeDepartmentHistories.Remove(this); + } + _shift.Entity = value; + if(value == null) + { + _shiftId = default(System.Byte); + } + else + { + value.EmployeeDepartmentHistories.Add(this); + _shiftId = value.ShiftId; + } + this.SendPropertyChanged("Shift"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/EmployeePayHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/EmployeePayHistory.cs new file mode 100644 index 0000000..94b4994 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/EmployeePayHistory.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'EmployeePayHistory', mapped on table 'AdventureWorks.HumanResources.EmployeePayHistory'. + public partial class EmployeePayHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.Byte _payFrequency; + private System.Decimal _rate; + private System.DateTime _rateChangeDate; + private EntityRef _employee; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPayFrequencyChanging(System.Byte value); + partial void OnPayFrequencyChanged(); + partial void OnRateChanging(System.Decimal value); + partial void OnRateChanged(); + partial void OnRateChangeDateChanging(System.DateTime value); + partial void OnRateChangeDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public EmployeePayHistory() + { + _employee = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PayFrequency field. Mapped on target field 'PayFrequency'. + public System.Byte PayFrequency + { + get { return _payFrequency; } + set + { + if((_payFrequency != value)) + { + OnPayFrequencyChanging(value); + SendPropertyChanging("PayFrequency"); + _payFrequency = value; + SendPropertyChanged("PayFrequency"); + OnPayFrequencyChanged(); + } + } + } + + /// Gets or sets the Rate field. Mapped on target field 'Rate'. + public System.Decimal Rate + { + get { return _rate; } + set + { + if((_rate != value)) + { + OnRateChanging(value); + SendPropertyChanging("Rate"); + _rate = value; + SendPropertyChanged("Rate"); + OnRateChanged(); + } + } + } + + /// Gets or sets the RateChangeDate field. Mapped on target field 'RateChangeDate'. + public System.DateTime RateChangeDate + { + get { return _rateChangeDate; } + set + { + if((_rateChangeDate != value)) + { + OnRateChangeDateChanging(value); + SendPropertyChanging("RateChangeDate"); + _rateChangeDate = value; + SendPropertyChanged("RateChangeDate"); + OnRateChangeDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeePayHistory.Employee - Employee.EmployeePayHistories (m:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.EmployeePayHistories.Remove(this); + } + _employee.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.EmployeePayHistories.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ErrorLog.cs b/tests/AdventureWorks2008Model/EntityClasses/ErrorLog.cs new file mode 100644 index 0000000..5f4d94a --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ErrorLog.cs @@ -0,0 +1,242 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ErrorLog', mapped on table 'AdventureWorks.dbo.ErrorLog'. + public partial class ErrorLog : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private Nullable _errorLine; + private System.Int32 _errorLogId; + private System.String _errorMessage; + private System.Int32 _errorNumber; + private System.String _errorProcedure; + private Nullable _errorSeverity; + private Nullable _errorState; + private System.DateTime _errorTime; + private System.String _userName; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnErrorLineChanging(Nullable value); + partial void OnErrorLineChanged(); + partial void OnErrorLogIdChanging(System.Int32 value); + partial void OnErrorLogIdChanged(); + partial void OnErrorMessageChanging(System.String value); + partial void OnErrorMessageChanged(); + partial void OnErrorNumberChanging(System.Int32 value); + partial void OnErrorNumberChanged(); + partial void OnErrorProcedureChanging(System.String value); + partial void OnErrorProcedureChanged(); + partial void OnErrorSeverityChanging(Nullable value); + partial void OnErrorSeverityChanged(); + partial void OnErrorStateChanging(Nullable value); + partial void OnErrorStateChanged(); + partial void OnErrorTimeChanging(System.DateTime value); + partial void OnErrorTimeChanged(); + partial void OnUserNameChanging(System.String value); + partial void OnUserNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public ErrorLog() + { + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ErrorLine field. Mapped on target field 'ErrorLine'. + public Nullable ErrorLine + { + get { return _errorLine; } + set + { + if((_errorLine != value)) + { + OnErrorLineChanging(value); + SendPropertyChanging("ErrorLine"); + _errorLine = value; + SendPropertyChanged("ErrorLine"); + OnErrorLineChanged(); + } + } + } + + /// Gets or sets the ErrorLogId field. Mapped on target field 'ErrorLogID'. + public System.Int32 ErrorLogId + { + get { return _errorLogId; } + set + { + if((_errorLogId != value)) + { + OnErrorLogIdChanging(value); + SendPropertyChanging("ErrorLogId"); + _errorLogId = value; + SendPropertyChanged("ErrorLogId"); + OnErrorLogIdChanged(); + } + } + } + + /// Gets or sets the ErrorMessage field. Mapped on target field 'ErrorMessage'. + public System.String ErrorMessage + { + get { return _errorMessage; } + set + { + if((_errorMessage != value)) + { + OnErrorMessageChanging(value); + SendPropertyChanging("ErrorMessage"); + _errorMessage = value; + SendPropertyChanged("ErrorMessage"); + OnErrorMessageChanged(); + } + } + } + + /// Gets or sets the ErrorNumber field. Mapped on target field 'ErrorNumber'. + public System.Int32 ErrorNumber + { + get { return _errorNumber; } + set + { + if((_errorNumber != value)) + { + OnErrorNumberChanging(value); + SendPropertyChanging("ErrorNumber"); + _errorNumber = value; + SendPropertyChanged("ErrorNumber"); + OnErrorNumberChanged(); + } + } + } + + /// Gets or sets the ErrorProcedure field. Mapped on target field 'ErrorProcedure'. + public System.String ErrorProcedure + { + get { return _errorProcedure; } + set + { + if((_errorProcedure != value)) + { + OnErrorProcedureChanging(value); + SendPropertyChanging("ErrorProcedure"); + _errorProcedure = value; + SendPropertyChanged("ErrorProcedure"); + OnErrorProcedureChanged(); + } + } + } + + /// Gets or sets the ErrorSeverity field. Mapped on target field 'ErrorSeverity'. + public Nullable ErrorSeverity + { + get { return _errorSeverity; } + set + { + if((_errorSeverity != value)) + { + OnErrorSeverityChanging(value); + SendPropertyChanging("ErrorSeverity"); + _errorSeverity = value; + SendPropertyChanged("ErrorSeverity"); + OnErrorSeverityChanged(); + } + } + } + + /// Gets or sets the ErrorState field. Mapped on target field 'ErrorState'. + public Nullable ErrorState + { + get { return _errorState; } + set + { + if((_errorState != value)) + { + OnErrorStateChanging(value); + SendPropertyChanging("ErrorState"); + _errorState = value; + SendPropertyChanged("ErrorState"); + OnErrorStateChanged(); + } + } + } + + /// Gets or sets the ErrorTime field. Mapped on target field 'ErrorTime'. + public System.DateTime ErrorTime + { + get { return _errorTime; } + set + { + if((_errorTime != value)) + { + OnErrorTimeChanging(value); + SendPropertyChanging("ErrorTime"); + _errorTime = value; + SendPropertyChanged("ErrorTime"); + OnErrorTimeChanged(); + } + } + } + + /// Gets or sets the UserName field. Mapped on target field 'UserName'. + public System.String UserName + { + get { return _userName; } + set + { + if((_userName != value)) + { + OnUserNameChanging(value); + SendPropertyChanging("UserName"); + _userName = value; + SendPropertyChanged("UserName"); + OnUserNameChanged(); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Illustration.cs b/tests/AdventureWorks2008Model/EntityClasses/Illustration.cs new file mode 100644 index 0000000..b9afe07 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Illustration.cs @@ -0,0 +1,147 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Illustration', mapped on table 'AdventureWorks.Production.Illustration'. + public partial class Illustration : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _diagram; + private System.Int32 _illustrationId; + private System.DateTime _modifiedDate; + private EntitySet _productModelIllustrations; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDiagramChanging(System.String value); + partial void OnDiagramChanged(); + partial void OnIllustrationIdChanging(System.Int32 value); + partial void OnIllustrationIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public Illustration() + { + _productModelIllustrations = new EntitySet(new Action(this.Attach_ProductModelIllustrations), new Action(this.Detach_ProductModelIllustrations) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductModelIllustrations(ProductModelIllustration entity) + { + this.SendPropertyChanging("ProductModelIllustrations"); + entity.Illustration = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductModelIllustrations(ProductModelIllustration entity) + { + this.SendPropertyChanging("ProductModelIllustrations"); + entity.Illustration = null; + } + + + #region Class Property Declarations + /// Gets or sets the Diagram field. Mapped on target field 'Diagram'. + public System.String Diagram + { + get { return _diagram; } + set + { + if((_diagram != value)) + { + OnDiagramChanging(value); + SendPropertyChanging("Diagram"); + _diagram = value; + SendPropertyChanged("Diagram"); + OnDiagramChanged(); + } + } + } + + /// Gets or sets the IllustrationId field. Mapped on target field 'IllustrationID'. + public System.Int32 IllustrationId + { + get { return _illustrationId; } + set + { + if((_illustrationId != value)) + { + OnIllustrationIdChanging(value); + SendPropertyChanging("IllustrationId"); + _illustrationId = value; + SendPropertyChanged("IllustrationId"); + OnIllustrationIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelIllustration.Illustration - Illustration.ProductModelIllustrations (m:1)' + public EntitySet ProductModelIllustrations + { + get { return this._productModelIllustrations; } + set { this._productModelIllustrations.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/JobCandidate.cs b/tests/AdventureWorks2008Model/EntityClasses/JobCandidate.cs new file mode 100644 index 0000000..07cfe80 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/JobCandidate.cs @@ -0,0 +1,178 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'JobCandidate', mapped on table 'AdventureWorks.HumanResources.JobCandidate'. + public partial class JobCandidate : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private Nullable _businessEntityId; + private System.Int32 _jobCandidateId; + private System.DateTime _modifiedDate; + private System.String _resume; + private EntityRef _employee; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(Nullable value); + partial void OnBusinessEntityIdChanged(); + partial void OnJobCandidateIdChanging(System.Int32 value); + partial void OnJobCandidateIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnResumeChanging(System.String value); + partial void OnResumeChanged(); + #endregion + + /// Initializes a new instance of the class. + public JobCandidate() + { + _employee = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public Nullable BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the JobCandidateId field. Mapped on target field 'JobCandidateID'. + public System.Int32 JobCandidateId + { + get { return _jobCandidateId; } + set + { + if((_jobCandidateId != value)) + { + OnJobCandidateIdChanging(value); + SendPropertyChanging("JobCandidateId"); + _jobCandidateId = value; + SendPropertyChanged("JobCandidateId"); + OnJobCandidateIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Resume field. Mapped on target field 'Resume'. + public System.String Resume + { + get { return _resume; } + set + { + if((_resume != value)) + { + OnResumeChanging(value); + SendPropertyChanging("Resume"); + _resume = value; + SendPropertyChanged("Resume"); + OnResumeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'JobCandidate.Employee - Employee.JobCandidates (m:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.JobCandidates.Remove(this); + } + _employee.Entity = value; + if(value == null) + { + _businessEntityId = default(Nullable); + } + else + { + value.JobCandidates.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Location.cs b/tests/AdventureWorks2008Model/EntityClasses/Location.cs new file mode 100644 index 0000000..297c40e --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Location.cs @@ -0,0 +1,212 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Location', mapped on table 'AdventureWorks.Production.Location'. + public partial class Location : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _availability; + private System.Decimal _costRate; + private System.Int16 _locationId; + private System.DateTime _modifiedDate; + private System.String _name; + private EntitySet _productInventories; + private EntitySet _workOrderRoutings; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAvailabilityChanging(System.Decimal value); + partial void OnAvailabilityChanged(); + partial void OnCostRateChanging(System.Decimal value); + partial void OnCostRateChanged(); + partial void OnLocationIdChanging(System.Int16 value); + partial void OnLocationIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public Location() + { + _productInventories = new EntitySet(new Action(this.Attach_ProductInventories), new Action(this.Detach_ProductInventories) ); + _workOrderRoutings = new EntitySet(new Action(this.Attach_WorkOrderRoutings), new Action(this.Detach_WorkOrderRoutings) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductInventories(ProductInventory entity) + { + this.SendPropertyChanging("ProductInventories"); + entity.Location = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductInventories(ProductInventory entity) + { + this.SendPropertyChanging("ProductInventories"); + entity.Location = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_WorkOrderRoutings(WorkOrderRouting entity) + { + this.SendPropertyChanging("WorkOrderRoutings"); + entity.Location = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_WorkOrderRoutings(WorkOrderRouting entity) + { + this.SendPropertyChanging("WorkOrderRoutings"); + entity.Location = null; + } + + + #region Class Property Declarations + /// Gets or sets the Availability field. Mapped on target field 'Availability'. + public System.Decimal Availability + { + get { return _availability; } + set + { + if((_availability != value)) + { + OnAvailabilityChanging(value); + SendPropertyChanging("Availability"); + _availability = value; + SendPropertyChanged("Availability"); + OnAvailabilityChanged(); + } + } + } + + /// Gets or sets the CostRate field. Mapped on target field 'CostRate'. + public System.Decimal CostRate + { + get { return _costRate; } + set + { + if((_costRate != value)) + { + OnCostRateChanging(value); + SendPropertyChanging("CostRate"); + _costRate = value; + SendPropertyChanged("CostRate"); + OnCostRateChanged(); + } + } + } + + /// Gets or sets the LocationId field. Mapped on target field 'LocationID'. + public System.Int16 LocationId + { + get { return _locationId; } + set + { + if((_locationId != value)) + { + OnLocationIdChanging(value); + SendPropertyChanging("LocationId"); + _locationId = value; + SendPropertyChanged("LocationId"); + OnLocationIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductInventory.Location - Location.ProductInventories (m:1)' + public EntitySet ProductInventories + { + get { return this._productInventories; } + set { this._productInventories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrderRouting.Location - Location.WorkOrderRoutings (m:1)' + public EntitySet WorkOrderRoutings + { + get { return this._workOrderRoutings; } + set { this._workOrderRoutings.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Password.cs b/tests/AdventureWorks2008Model/EntityClasses/Password.cs new file mode 100644 index 0000000..66bb210 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Password.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Password', mapped on table 'AdventureWorks.Person.Password'. + public partial class Password : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.String _passwordHash; + private System.String _passwordSalt; + private System.Guid _rowguid; + private EntityRef _person; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPasswordHashChanging(System.String value); + partial void OnPasswordHashChanged(); + partial void OnPasswordSaltChanging(System.String value); + partial void OnPasswordSaltChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public Password() + { + _person = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PasswordHash field. Mapped on target field 'PasswordHash'. + public System.String PasswordHash + { + get { return _passwordHash; } + set + { + if((_passwordHash != value)) + { + OnPasswordHashChanging(value); + SendPropertyChanging("PasswordHash"); + _passwordHash = value; + SendPropertyChanged("PasswordHash"); + OnPasswordHashChanged(); + } + } + } + + /// Gets or sets the PasswordSalt field. Mapped on target field 'PasswordSalt'. + public System.String PasswordSalt + { + get { return _passwordSalt; } + set + { + if((_passwordSalt != value)) + { + OnPasswordSaltChanging(value); + SendPropertyChanging("PasswordSalt"); + _passwordSalt = value; + SendPropertyChanged("PasswordSalt"); + OnPasswordSaltChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Password.Person - Person.Password (1:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.Password=null; + } + _person.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.Password = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Person.cs b/tests/AdventureWorks2008Model/EntityClasses/Person.cs new file mode 100644 index 0000000..13ba94b --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Person.cs @@ -0,0 +1,537 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Person', mapped on table 'AdventureWorks.Person.Person'. + public partial class Person : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _additionalContactInfo; + private System.Int32 _businessEntityId; + private System.String _demographics; + private System.Int32 _emailPromotion; + private System.String _firstName; + private System.String _lastName; + private System.String _middleName; + private System.DateTime _modifiedDate; + private System.Boolean _nameStyle; + private System.String _personType; + private System.Guid _rowguid; + private System.String _suffix; + private System.String _title; + private EntityRef _businessEntity; + private EntitySet _businessEntityContacts; + private EntitySet _customers; + private EntitySet _emailAddresses; + private EntityRef _employee; + private EntityRef _password; + private EntitySet _personCreditCards; + private EntitySet _personPhones; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAdditionalContactInfoChanging(System.String value); + partial void OnAdditionalContactInfoChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnDemographicsChanging(System.String value); + partial void OnDemographicsChanged(); + partial void OnEmailPromotionChanging(System.Int32 value); + partial void OnEmailPromotionChanged(); + partial void OnFirstNameChanging(System.String value); + partial void OnFirstNameChanged(); + partial void OnLastNameChanging(System.String value); + partial void OnLastNameChanged(); + partial void OnMiddleNameChanging(System.String value); + partial void OnMiddleNameChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameStyleChanging(System.Boolean value); + partial void OnNameStyleChanged(); + partial void OnPersonTypeChanging(System.String value); + partial void OnPersonTypeChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSuffixChanging(System.String value); + partial void OnSuffixChanged(); + partial void OnTitleChanging(System.String value); + partial void OnTitleChanged(); + #endregion + + /// Initializes a new instance of the class. + public Person() + { + _businessEntity = default(EntityRef); + _businessEntityContacts = new EntitySet(new Action(this.Attach_BusinessEntityContacts), new Action(this.Detach_BusinessEntityContacts) ); + _customers = new EntitySet(new Action(this.Attach_Customers), new Action(this.Detach_Customers) ); + _emailAddresses = new EntitySet(new Action(this.Attach_EmailAddresses), new Action(this.Detach_EmailAddresses) ); + _employee = default(EntityRef); + _password = default(EntityRef); + _personCreditCards = new EntitySet(new Action(this.Attach_PersonCreditCards), new Action(this.Detach_PersonCreditCards) ); + _personPhones = new EntitySet(new Action(this.Attach_PersonPhones), new Action(this.Detach_PersonPhones) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.Person = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BusinessEntityContacts(BusinessEntityContact entity) + { + this.SendPropertyChanging("BusinessEntityContacts"); + entity.Person = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.Person = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.Person = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_EmailAddresses(EmailAddress entity) + { + this.SendPropertyChanging("EmailAddresses"); + entity.Person = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_EmailAddresses(EmailAddress entity) + { + this.SendPropertyChanging("EmailAddresses"); + entity.Person = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PersonCreditCards(PersonCreditCard entity) + { + this.SendPropertyChanging("PersonCreditCards"); + entity.Person = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PersonCreditCards(PersonCreditCard entity) + { + this.SendPropertyChanging("PersonCreditCards"); + entity.Person = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PersonPhones(PersonPhone entity) + { + this.SendPropertyChanging("PersonPhones"); + entity.Person = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PersonPhones(PersonPhone entity) + { + this.SendPropertyChanging("PersonPhones"); + entity.Person = null; + } + + + #region Class Property Declarations + /// Gets or sets the AdditionalContactInfo field. Mapped on target field 'AdditionalContactInfo'. + public System.String AdditionalContactInfo + { + get { return _additionalContactInfo; } + set + { + if((_additionalContactInfo != value)) + { + OnAdditionalContactInfoChanging(value); + SendPropertyChanging("AdditionalContactInfo"); + _additionalContactInfo = value; + SendPropertyChanged("AdditionalContactInfo"); + OnAdditionalContactInfoChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_businessEntity.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the Demographics field. Mapped on target field 'Demographics'. + public System.String Demographics + { + get { return _demographics; } + set + { + if((_demographics != value)) + { + OnDemographicsChanging(value); + SendPropertyChanging("Demographics"); + _demographics = value; + SendPropertyChanged("Demographics"); + OnDemographicsChanged(); + } + } + } + + /// Gets or sets the EmailPromotion field. Mapped on target field 'EmailPromotion'. + public System.Int32 EmailPromotion + { + get { return _emailPromotion; } + set + { + if((_emailPromotion != value)) + { + OnEmailPromotionChanging(value); + SendPropertyChanging("EmailPromotion"); + _emailPromotion = value; + SendPropertyChanged("EmailPromotion"); + OnEmailPromotionChanged(); + } + } + } + + /// Gets or sets the FirstName field. Mapped on target field 'FirstName'. + public System.String FirstName + { + get { return _firstName; } + set + { + if((_firstName != value)) + { + OnFirstNameChanging(value); + SendPropertyChanging("FirstName"); + _firstName = value; + SendPropertyChanged("FirstName"); + OnFirstNameChanged(); + } + } + } + + /// Gets or sets the LastName field. Mapped on target field 'LastName'. + public System.String LastName + { + get { return _lastName; } + set + { + if((_lastName != value)) + { + OnLastNameChanging(value); + SendPropertyChanging("LastName"); + _lastName = value; + SendPropertyChanged("LastName"); + OnLastNameChanged(); + } + } + } + + /// Gets or sets the MiddleName field. Mapped on target field 'MiddleName'. + public System.String MiddleName + { + get { return _middleName; } + set + { + if((_middleName != value)) + { + OnMiddleNameChanging(value); + SendPropertyChanging("MiddleName"); + _middleName = value; + SendPropertyChanged("MiddleName"); + OnMiddleNameChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the NameStyle field. Mapped on target field 'NameStyle'. + public System.Boolean NameStyle + { + get { return _nameStyle; } + set + { + if((_nameStyle != value)) + { + OnNameStyleChanging(value); + SendPropertyChanging("NameStyle"); + _nameStyle = value; + SendPropertyChanged("NameStyle"); + OnNameStyleChanged(); + } + } + } + + /// Gets or sets the PersonType field. Mapped on target field 'PersonType'. + public System.String PersonType + { + get { return _personType; } + set + { + if((_personType != value)) + { + OnPersonTypeChanging(value); + SendPropertyChanging("PersonType"); + _personType = value; + SendPropertyChanged("PersonType"); + OnPersonTypeChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the Suffix field. Mapped on target field 'Suffix'. + public System.String Suffix + { + get { return _suffix; } + set + { + if((_suffix != value)) + { + OnSuffixChanging(value); + SendPropertyChanging("Suffix"); + _suffix = value; + SendPropertyChanged("Suffix"); + OnSuffixChanged(); + } + } + } + + /// Gets or sets the Title field. Mapped on target field 'Title'. + public System.String Title + { + get { return _title; } + set + { + if((_title != value)) + { + OnTitleChanging(value); + SendPropertyChanging("Title"); + _title = value; + SendPropertyChanged("Title"); + OnTitleChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Person.BusinessEntity - BusinessEntity.Person (1:1)' + public BusinessEntity BusinessEntity + { + get { return _businessEntity.Entity; } + set + { + BusinessEntity previousValue = _businessEntity.Entity; + if((previousValue != value) || (_businessEntity.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("BusinessEntity"); + if(previousValue != null) + { + _businessEntity.Entity = null; + previousValue.Person=null; + } + _businessEntity.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.Person = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("BusinessEntity"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BusinessEntityContact.Person - Person.BusinessEntityContacts (m:1)' + public EntitySet BusinessEntityContacts + { + get { return this._businessEntityContacts; } + set { this._businessEntityContacts.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Customer.Person - Person.Customers (m:1)' + public EntitySet Customers + { + get { return this._customers; } + set { this._customers.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'EmailAddress.Person - Person.EmailAddresses (m:1)' + public EntitySet EmailAddresses + { + get { return this._emailAddresses; } + set { this._emailAddresses.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Employee.Person - Person.Employee (1:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.Person=null; + } + _employee.Entity = value; + if(value != null) + { + value.Person = this; + } + this.SendPropertyChanged("Employee"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Password.Person - Person.Password (1:1)' + public Password Password + { + get { return _password.Entity; } + set + { + Password previousValue = _password.Entity; + if((previousValue != value) || (_password.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Password"); + if(previousValue != null) + { + _password.Entity = null; + previousValue.Person=null; + } + _password.Entity = value; + if(value != null) + { + value.Person = this; + } + this.SendPropertyChanged("Password"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonCreditCard.Person - Person.PersonCreditCards (m:1)' + public EntitySet PersonCreditCards + { + get { return this._personCreditCards; } + set { this._personCreditCards.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'PersonPhone.Person - Person.PersonPhones (m:1)' + public EntitySet PersonPhones + { + get { return this._personPhones; } + set { this._personPhones.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/PersonCreditCard.cs b/tests/AdventureWorks2008Model/EntityClasses/PersonCreditCard.cs new file mode 100644 index 0000000..ebafd3f --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/PersonCreditCard.cs @@ -0,0 +1,194 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'PersonCreditCard', mapped on table 'AdventureWorks.Sales.PersonCreditCard'. + public partial class PersonCreditCard : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.Int32 _creditCardId; + private System.DateTime _modifiedDate; + private EntityRef _creditCard; + private EntityRef _person; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnCreditCardIdChanging(System.Int32 value); + partial void OnCreditCardIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public PersonCreditCard() + { + _creditCard = default(EntityRef); + _person = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the CreditCardId field. Mapped on target field 'CreditCardID'. + public System.Int32 CreditCardId + { + get { return _creditCardId; } + set + { + if((_creditCardId != value)) + { + if(_creditCard.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCreditCardIdChanging(value); + SendPropertyChanging("CreditCardId"); + _creditCardId = value; + SendPropertyChanged("CreditCardId"); + OnCreditCardIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonCreditCard.CreditCard - CreditCard.PersonCreditCards (m:1)' + public CreditCard CreditCard + { + get { return _creditCard.Entity; } + set + { + CreditCard previousValue = _creditCard.Entity; + if((previousValue != value) || (_creditCard.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CreditCard"); + if(previousValue != null) + { + _creditCard.Entity = null; + previousValue.PersonCreditCards.Remove(this); + } + _creditCard.Entity = value; + if(value == null) + { + _creditCardId = default(System.Int32); + } + else + { + value.PersonCreditCards.Add(this); + _creditCardId = value.CreditCardId; + } + this.SendPropertyChanged("CreditCard"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonCreditCard.Person - Person.PersonCreditCards (m:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.PersonCreditCards.Remove(this); + } + _person.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.PersonCreditCards.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/PersonPhone.cs b/tests/AdventureWorks2008Model/EntityClasses/PersonPhone.cs new file mode 100644 index 0000000..852ed41 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/PersonPhone.cs @@ -0,0 +1,214 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'PersonPhone', mapped on table 'AdventureWorks.Person.PersonPhone'. + public partial class PersonPhone : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.String _phoneNumber; + private System.Int32 _phoneNumberTypeId; + private EntityRef _person; + private EntityRef _phoneNumberType; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPhoneNumberChanging(System.String value); + partial void OnPhoneNumberChanged(); + partial void OnPhoneNumberTypeIdChanging(System.Int32 value); + partial void OnPhoneNumberTypeIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public PersonPhone() + { + _person = default(EntityRef); + _phoneNumberType = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_person.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the PhoneNumber field. Mapped on target field 'PhoneNumber'. + public System.String PhoneNumber + { + get { return _phoneNumber; } + set + { + if((_phoneNumber != value)) + { + OnPhoneNumberChanging(value); + SendPropertyChanging("PhoneNumber"); + _phoneNumber = value; + SendPropertyChanged("PhoneNumber"); + OnPhoneNumberChanged(); + } + } + } + + /// Gets or sets the PhoneNumberTypeId field. Mapped on target field 'PhoneNumberTypeID'. + public System.Int32 PhoneNumberTypeId + { + get { return _phoneNumberTypeId; } + set + { + if((_phoneNumberTypeId != value)) + { + if(_phoneNumberType.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnPhoneNumberTypeIdChanging(value); + SendPropertyChanging("PhoneNumberTypeId"); + _phoneNumberTypeId = value; + SendPropertyChanged("PhoneNumberTypeId"); + OnPhoneNumberTypeIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonPhone.Person - Person.PersonPhones (m:1)' + public Person Person + { + get { return _person.Entity; } + set + { + Person previousValue = _person.Entity; + if((previousValue != value) || (_person.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Person"); + if(previousValue != null) + { + _person.Entity = null; + previousValue.PersonPhones.Remove(this); + } + _person.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.PersonPhones.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Person"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonPhone.PhoneNumberType - PhoneNumberType.PersonPhones (m:1)' + public PhoneNumberType PhoneNumberType + { + get { return _phoneNumberType.Entity; } + set + { + PhoneNumberType previousValue = _phoneNumberType.Entity; + if((previousValue != value) || (_phoneNumberType.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("PhoneNumberType"); + if(previousValue != null) + { + _phoneNumberType.Entity = null; + previousValue.PersonPhones.Remove(this); + } + _phoneNumberType.Entity = value; + if(value == null) + { + _phoneNumberTypeId = default(System.Int32); + } + else + { + value.PersonPhones.Add(this); + _phoneNumberTypeId = value.PhoneNumberTypeId; + } + this.SendPropertyChanged("PhoneNumberType"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/PhoneNumberType.cs b/tests/AdventureWorks2008Model/EntityClasses/PhoneNumberType.cs new file mode 100644 index 0000000..ff90476 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/PhoneNumberType.cs @@ -0,0 +1,147 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'PhoneNumberType', mapped on table 'AdventureWorks.Person.PhoneNumberType'. + public partial class PhoneNumberType : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int32 _phoneNumberTypeId; + private EntitySet _personPhones; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnPhoneNumberTypeIdChanging(System.Int32 value); + partial void OnPhoneNumberTypeIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public PhoneNumberType() + { + _personPhones = new EntitySet(new Action(this.Attach_PersonPhones), new Action(this.Detach_PersonPhones) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PersonPhones(PersonPhone entity) + { + this.SendPropertyChanging("PersonPhones"); + entity.PhoneNumberType = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PersonPhones(PersonPhone entity) + { + this.SendPropertyChanging("PersonPhones"); + entity.PhoneNumberType = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the PhoneNumberTypeId field. Mapped on target field 'PhoneNumberTypeID'. + public System.Int32 PhoneNumberTypeId + { + get { return _phoneNumberTypeId; } + set + { + if((_phoneNumberTypeId != value)) + { + OnPhoneNumberTypeIdChanging(value); + SendPropertyChanging("PhoneNumberTypeId"); + _phoneNumberTypeId = value; + SendPropertyChanged("PhoneNumberTypeId"); + OnPhoneNumberTypeIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PersonPhone.PhoneNumberType - PhoneNumberType.PersonPhones (m:1)' + public EntitySet PersonPhones + { + get { return this._personPhones; } + set { this._personPhones.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Product.cs b/tests/AdventureWorks2008Model/EntityClasses/Product.cs new file mode 100644 index 0000000..e28216c --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Product.cs @@ -0,0 +1,1056 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Product', mapped on table 'AdventureWorks.Production.Product'. + public partial class Product : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _class; + private System.String _color; + private System.Int32 _daysToManufacture; + private Nullable _discontinuedDate; + private System.Boolean _finishedGoodsFlag; + private System.Decimal _listPrice; + private System.Boolean _makeFlag; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int32 _productId; + private System.String _productLine; + private Nullable _productModelId; + private System.String _productNumber; + private Nullable _productSubcategoryId; + private System.Int16 _reorderPoint; + private System.Guid _rowguid; + private System.Int16 _safetyStockLevel; + private Nullable _sellEndDate; + private System.DateTime _sellStartDate; + private System.String _size; + private System.String _sizeUnitMeasureCode; + private System.Decimal _standardCost; + private System.String _style; + private Nullable _weight; + private System.String _weightUnitMeasureCode; + private EntitySet _billOfMaterials; + private EntitySet _billOfMaterials1; + private EntitySet _productCostHistories; + private EntitySet _productDocuments; + private EntitySet _productInventories; + private EntitySet _productListPriceHistories; + private EntityRef _productModel; + private EntitySet _productProductPhotos; + private EntitySet _productReviews; + private EntityRef _productSubcategory; + private EntitySet _productVendors; + private EntitySet _purchaseOrderDetails; + private EntitySet _shoppingCartItems; + private EntitySet _specialOfferProducts; + private EntitySet _transactionHistories; + private EntityRef _unitMeasure; + private EntityRef _unitMeasure1; + private EntitySet _workOrders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnClassChanging(System.String value); + partial void OnClassChanged(); + partial void OnColorChanging(System.String value); + partial void OnColorChanged(); + partial void OnDaysToManufactureChanging(System.Int32 value); + partial void OnDaysToManufactureChanged(); + partial void OnDiscontinuedDateChanging(Nullable value); + partial void OnDiscontinuedDateChanged(); + partial void OnFinishedGoodsFlagChanging(System.Boolean value); + partial void OnFinishedGoodsFlagChanged(); + partial void OnListPriceChanging(System.Decimal value); + partial void OnListPriceChanged(); + partial void OnMakeFlagChanging(System.Boolean value); + partial void OnMakeFlagChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnProductLineChanging(System.String value); + partial void OnProductLineChanged(); + partial void OnProductModelIdChanging(Nullable value); + partial void OnProductModelIdChanged(); + partial void OnProductNumberChanging(System.String value); + partial void OnProductNumberChanged(); + partial void OnProductSubcategoryIdChanging(Nullable value); + partial void OnProductSubcategoryIdChanged(); + partial void OnReorderPointChanging(System.Int16 value); + partial void OnReorderPointChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSafetyStockLevelChanging(System.Int16 value); + partial void OnSafetyStockLevelChanged(); + partial void OnSellEndDateChanging(Nullable value); + partial void OnSellEndDateChanged(); + partial void OnSellStartDateChanging(System.DateTime value); + partial void OnSellStartDateChanged(); + partial void OnSizeChanging(System.String value); + partial void OnSizeChanged(); + partial void OnSizeUnitMeasureCodeChanging(System.String value); + partial void OnSizeUnitMeasureCodeChanged(); + partial void OnStandardCostChanging(System.Decimal value); + partial void OnStandardCostChanged(); + partial void OnStyleChanging(System.String value); + partial void OnStyleChanged(); + partial void OnWeightChanging(Nullable value); + partial void OnWeightChanged(); + partial void OnWeightUnitMeasureCodeChanging(System.String value); + partial void OnWeightUnitMeasureCodeChanged(); + #endregion + + /// Initializes a new instance of the class. + public Product() + { + _billOfMaterials = new EntitySet(new Action(this.Attach_BillOfMaterials), new Action(this.Detach_BillOfMaterials) ); + _billOfMaterials1 = new EntitySet(new Action(this.Attach_BillOfMaterials1), new Action(this.Detach_BillOfMaterials1) ); + _productCostHistories = new EntitySet(new Action(this.Attach_ProductCostHistories), new Action(this.Detach_ProductCostHistories) ); + _productDocuments = new EntitySet(new Action(this.Attach_ProductDocuments), new Action(this.Detach_ProductDocuments) ); + _productInventories = new EntitySet(new Action(this.Attach_ProductInventories), new Action(this.Detach_ProductInventories) ); + _productListPriceHistories = new EntitySet(new Action(this.Attach_ProductListPriceHistories), new Action(this.Detach_ProductListPriceHistories) ); + _productModel = default(EntityRef); + _productProductPhotos = new EntitySet(new Action(this.Attach_ProductProductPhotos), new Action(this.Detach_ProductProductPhotos) ); + _productReviews = new EntitySet(new Action(this.Attach_ProductReviews), new Action(this.Detach_ProductReviews) ); + _productSubcategory = default(EntityRef); + _productVendors = new EntitySet(new Action(this.Attach_ProductVendors), new Action(this.Detach_ProductVendors) ); + _purchaseOrderDetails = new EntitySet(new Action(this.Attach_PurchaseOrderDetails), new Action(this.Detach_PurchaseOrderDetails) ); + _shoppingCartItems = new EntitySet(new Action(this.Attach_ShoppingCartItems), new Action(this.Detach_ShoppingCartItems) ); + _specialOfferProducts = new EntitySet(new Action(this.Attach_SpecialOfferProducts), new Action(this.Detach_SpecialOfferProducts) ); + _transactionHistories = new EntitySet(new Action(this.Attach_TransactionHistories), new Action(this.Detach_TransactionHistories) ); + _unitMeasure = default(EntityRef); + _unitMeasure1 = default(EntityRef); + _workOrders = new EntitySet(new Action(this.Attach_WorkOrders), new Action(this.Detach_WorkOrders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BillOfMaterials(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BillOfMaterials(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BillOfMaterials1(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials1"); + entity.Product1 = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BillOfMaterials1(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials1"); + entity.Product1 = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductCostHistories(ProductCostHistory entity) + { + this.SendPropertyChanging("ProductCostHistories"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductCostHistories(ProductCostHistory entity) + { + this.SendPropertyChanging("ProductCostHistories"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductDocuments(ProductDocument entity) + { + this.SendPropertyChanging("ProductDocuments"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductDocuments(ProductDocument entity) + { + this.SendPropertyChanging("ProductDocuments"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductInventories(ProductInventory entity) + { + this.SendPropertyChanging("ProductInventories"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductInventories(ProductInventory entity) + { + this.SendPropertyChanging("ProductInventories"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductListPriceHistories(ProductListPriceHistory entity) + { + this.SendPropertyChanging("ProductListPriceHistories"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductListPriceHistories(ProductListPriceHistory entity) + { + this.SendPropertyChanging("ProductListPriceHistories"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductProductPhotos(ProductProductPhoto entity) + { + this.SendPropertyChanging("ProductProductPhotos"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductProductPhotos(ProductProductPhoto entity) + { + this.SendPropertyChanging("ProductProductPhotos"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductReviews(ProductReview entity) + { + this.SendPropertyChanging("ProductReviews"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductReviews(ProductReview entity) + { + this.SendPropertyChanging("ProductReviews"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PurchaseOrderDetails(PurchaseOrderDetail entity) + { + this.SendPropertyChanging("PurchaseOrderDetails"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PurchaseOrderDetails(PurchaseOrderDetail entity) + { + this.SendPropertyChanging("PurchaseOrderDetails"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ShoppingCartItems(ShoppingCartItem entity) + { + this.SendPropertyChanging("ShoppingCartItems"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ShoppingCartItems(ShoppingCartItem entity) + { + this.SendPropertyChanging("ShoppingCartItems"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SpecialOfferProducts(SpecialOfferProduct entity) + { + this.SendPropertyChanging("SpecialOfferProducts"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SpecialOfferProducts(SpecialOfferProduct entity) + { + this.SendPropertyChanging("SpecialOfferProducts"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_TransactionHistories(TransactionHistory entity) + { + this.SendPropertyChanging("TransactionHistories"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_TransactionHistories(TransactionHistory entity) + { + this.SendPropertyChanging("TransactionHistories"); + entity.Product = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_WorkOrders(WorkOrder entity) + { + this.SendPropertyChanging("WorkOrders"); + entity.Product = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_WorkOrders(WorkOrder entity) + { + this.SendPropertyChanging("WorkOrders"); + entity.Product = null; + } + + + #region Class Property Declarations + /// Gets or sets the Class field. Mapped on target field 'Class'. + public System.String Class + { + get { return _class; } + set + { + if((_class != value)) + { + OnClassChanging(value); + SendPropertyChanging("Class"); + _class = value; + SendPropertyChanged("Class"); + OnClassChanged(); + } + } + } + + /// Gets or sets the Color field. Mapped on target field 'Color'. + public System.String Color + { + get { return _color; } + set + { + if((_color != value)) + { + OnColorChanging(value); + SendPropertyChanging("Color"); + _color = value; + SendPropertyChanged("Color"); + OnColorChanged(); + } + } + } + + /// Gets or sets the DaysToManufacture field. Mapped on target field 'DaysToManufacture'. + public System.Int32 DaysToManufacture + { + get { return _daysToManufacture; } + set + { + if((_daysToManufacture != value)) + { + OnDaysToManufactureChanging(value); + SendPropertyChanging("DaysToManufacture"); + _daysToManufacture = value; + SendPropertyChanged("DaysToManufacture"); + OnDaysToManufactureChanged(); + } + } + } + + /// Gets or sets the DiscontinuedDate field. Mapped on target field 'DiscontinuedDate'. + public Nullable DiscontinuedDate + { + get { return _discontinuedDate; } + set + { + if((_discontinuedDate != value)) + { + OnDiscontinuedDateChanging(value); + SendPropertyChanging("DiscontinuedDate"); + _discontinuedDate = value; + SendPropertyChanged("DiscontinuedDate"); + OnDiscontinuedDateChanged(); + } + } + } + + /// Gets or sets the FinishedGoodsFlag field. Mapped on target field 'FinishedGoodsFlag'. + public System.Boolean FinishedGoodsFlag + { + get { return _finishedGoodsFlag; } + set + { + if((_finishedGoodsFlag != value)) + { + OnFinishedGoodsFlagChanging(value); + SendPropertyChanging("FinishedGoodsFlag"); + _finishedGoodsFlag = value; + SendPropertyChanged("FinishedGoodsFlag"); + OnFinishedGoodsFlagChanged(); + } + } + } + + /// Gets or sets the ListPrice field. Mapped on target field 'ListPrice'. + public System.Decimal ListPrice + { + get { return _listPrice; } + set + { + if((_listPrice != value)) + { + OnListPriceChanging(value); + SendPropertyChanging("ListPrice"); + _listPrice = value; + SendPropertyChanged("ListPrice"); + OnListPriceChanged(); + } + } + } + + /// Gets or sets the MakeFlag field. Mapped on target field 'MakeFlag'. + public System.Boolean MakeFlag + { + get { return _makeFlag; } + set + { + if((_makeFlag != value)) + { + OnMakeFlagChanging(value); + SendPropertyChanging("MakeFlag"); + _makeFlag = value; + SendPropertyChanged("MakeFlag"); + OnMakeFlagChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the ProductLine field. Mapped on target field 'ProductLine'. + public System.String ProductLine + { + get { return _productLine; } + set + { + if((_productLine != value)) + { + OnProductLineChanging(value); + SendPropertyChanging("ProductLine"); + _productLine = value; + SendPropertyChanged("ProductLine"); + OnProductLineChanged(); + } + } + } + + /// Gets or sets the ProductModelId field. Mapped on target field 'ProductModelID'. + public Nullable ProductModelId + { + get { return _productModelId; } + set + { + if((_productModelId != value)) + { + if(_productModel.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductModelIdChanging(value); + SendPropertyChanging("ProductModelId"); + _productModelId = value; + SendPropertyChanged("ProductModelId"); + OnProductModelIdChanged(); + } + } + } + + /// Gets or sets the ProductNumber field. Mapped on target field 'ProductNumber'. + public System.String ProductNumber + { + get { return _productNumber; } + set + { + if((_productNumber != value)) + { + OnProductNumberChanging(value); + SendPropertyChanging("ProductNumber"); + _productNumber = value; + SendPropertyChanged("ProductNumber"); + OnProductNumberChanged(); + } + } + } + + /// Gets or sets the ProductSubcategoryId field. Mapped on target field 'ProductSubcategoryID'. + public Nullable ProductSubcategoryId + { + get { return _productSubcategoryId; } + set + { + if((_productSubcategoryId != value)) + { + if(_productSubcategory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductSubcategoryIdChanging(value); + SendPropertyChanging("ProductSubcategoryId"); + _productSubcategoryId = value; + SendPropertyChanged("ProductSubcategoryId"); + OnProductSubcategoryIdChanged(); + } + } + } + + /// Gets or sets the ReorderPoint field. Mapped on target field 'ReorderPoint'. + public System.Int16 ReorderPoint + { + get { return _reorderPoint; } + set + { + if((_reorderPoint != value)) + { + OnReorderPointChanging(value); + SendPropertyChanging("ReorderPoint"); + _reorderPoint = value; + SendPropertyChanged("ReorderPoint"); + OnReorderPointChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SafetyStockLevel field. Mapped on target field 'SafetyStockLevel'. + public System.Int16 SafetyStockLevel + { + get { return _safetyStockLevel; } + set + { + if((_safetyStockLevel != value)) + { + OnSafetyStockLevelChanging(value); + SendPropertyChanging("SafetyStockLevel"); + _safetyStockLevel = value; + SendPropertyChanged("SafetyStockLevel"); + OnSafetyStockLevelChanged(); + } + } + } + + /// Gets or sets the SellEndDate field. Mapped on target field 'SellEndDate'. + public Nullable SellEndDate + { + get { return _sellEndDate; } + set + { + if((_sellEndDate != value)) + { + OnSellEndDateChanging(value); + SendPropertyChanging("SellEndDate"); + _sellEndDate = value; + SendPropertyChanged("SellEndDate"); + OnSellEndDateChanged(); + } + } + } + + /// Gets or sets the SellStartDate field. Mapped on target field 'SellStartDate'. + public System.DateTime SellStartDate + { + get { return _sellStartDate; } + set + { + if((_sellStartDate != value)) + { + OnSellStartDateChanging(value); + SendPropertyChanging("SellStartDate"); + _sellStartDate = value; + SendPropertyChanged("SellStartDate"); + OnSellStartDateChanged(); + } + } + } + + /// Gets or sets the Size field. Mapped on target field 'Size'. + public System.String Size + { + get { return _size; } + set + { + if((_size != value)) + { + OnSizeChanging(value); + SendPropertyChanging("Size"); + _size = value; + SendPropertyChanged("Size"); + OnSizeChanged(); + } + } + } + + /// Gets or sets the SizeUnitMeasureCode field. Mapped on target field 'SizeUnitMeasureCode'. + public System.String SizeUnitMeasureCode + { + get { return _sizeUnitMeasureCode; } + set + { + if((_sizeUnitMeasureCode != value)) + { + if(_unitMeasure.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSizeUnitMeasureCodeChanging(value); + SendPropertyChanging("SizeUnitMeasureCode"); + _sizeUnitMeasureCode = value; + SendPropertyChanged("SizeUnitMeasureCode"); + OnSizeUnitMeasureCodeChanged(); + } + } + } + + /// Gets or sets the StandardCost field. Mapped on target field 'StandardCost'. + public System.Decimal StandardCost + { + get { return _standardCost; } + set + { + if((_standardCost != value)) + { + OnStandardCostChanging(value); + SendPropertyChanging("StandardCost"); + _standardCost = value; + SendPropertyChanged("StandardCost"); + OnStandardCostChanged(); + } + } + } + + /// Gets or sets the Style field. Mapped on target field 'Style'. + public System.String Style + { + get { return _style; } + set + { + if((_style != value)) + { + OnStyleChanging(value); + SendPropertyChanging("Style"); + _style = value; + SendPropertyChanged("Style"); + OnStyleChanged(); + } + } + } + + /// Gets or sets the Weight field. Mapped on target field 'Weight'. + public Nullable Weight + { + get { return _weight; } + set + { + if((_weight != value)) + { + OnWeightChanging(value); + SendPropertyChanging("Weight"); + _weight = value; + SendPropertyChanged("Weight"); + OnWeightChanged(); + } + } + } + + /// Gets or sets the WeightUnitMeasureCode field. Mapped on target field 'WeightUnitMeasureCode'. + public System.String WeightUnitMeasureCode + { + get { return _weightUnitMeasureCode; } + set + { + if((_weightUnitMeasureCode != value)) + { + if(_unitMeasure1.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnWeightUnitMeasureCodeChanging(value); + SendPropertyChanging("WeightUnitMeasureCode"); + _weightUnitMeasureCode = value; + SendPropertyChanged("WeightUnitMeasureCode"); + OnWeightUnitMeasureCodeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.Product - Product.BillOfMaterials (m:1)' + public EntitySet BillOfMaterials + { + get { return this._billOfMaterials; } + set { this._billOfMaterials.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.Product1 - Product.BillOfMaterials1 (m:1)' + public EntitySet BillOfMaterials1 + { + get { return this._billOfMaterials1; } + set { this._billOfMaterials1.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductCostHistory.Product - Product.ProductCostHistories (m:1)' + public EntitySet ProductCostHistories + { + get { return this._productCostHistories; } + set { this._productCostHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductDocument.Product - Product.ProductDocuments (m:1)' + public EntitySet ProductDocuments + { + get { return this._productDocuments; } + set { this._productDocuments.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductInventory.Product - Product.ProductInventories (m:1)' + public EntitySet ProductInventories + { + get { return this._productInventories; } + set { this._productInventories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductListPriceHistory.Product - Product.ProductListPriceHistories (m:1)' + public EntitySet ProductListPriceHistories + { + get { return this._productListPriceHistories; } + set { this._productListPriceHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Product.ProductModel - ProductModel.Products (m:1)' + public ProductModel ProductModel + { + get { return _productModel.Entity; } + set + { + ProductModel previousValue = _productModel.Entity; + if((previousValue != value) || (_productModel.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductModel"); + if(previousValue != null) + { + _productModel.Entity = null; + previousValue.Products.Remove(this); + } + _productModel.Entity = value; + if(value == null) + { + _productModelId = default(Nullable); + } + else + { + value.Products.Add(this); + _productModelId = value.ProductModelId; + } + this.SendPropertyChanged("ProductModel"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductProductPhoto.Product - Product.ProductProductPhotos (m:1)' + public EntitySet ProductProductPhotos + { + get { return this._productProductPhotos; } + set { this._productProductPhotos.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductReview.Product - Product.ProductReviews (m:1)' + public EntitySet ProductReviews + { + get { return this._productReviews; } + set { this._productReviews.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Product.ProductSubcategory - ProductSubcategory.Products (m:1)' + public ProductSubcategory ProductSubcategory + { + get { return _productSubcategory.Entity; } + set + { + ProductSubcategory previousValue = _productSubcategory.Entity; + if((previousValue != value) || (_productSubcategory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductSubcategory"); + if(previousValue != null) + { + _productSubcategory.Entity = null; + previousValue.Products.Remove(this); + } + _productSubcategory.Entity = value; + if(value == null) + { + _productSubcategoryId = default(Nullable); + } + else + { + value.Products.Add(this); + _productSubcategoryId = value.ProductSubcategoryId; + } + this.SendPropertyChanged("ProductSubcategory"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.Product - Product.ProductVendors (m:1)' + public EntitySet ProductVendors + { + get { return this._productVendors; } + set { this._productVendors.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderDetail.Product - Product.PurchaseOrderDetails (m:1)' + public EntitySet PurchaseOrderDetails + { + get { return this._purchaseOrderDetails; } + set { this._purchaseOrderDetails.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ShoppingCartItem.Product - Product.ShoppingCartItems (m:1)' + public EntitySet ShoppingCartItems + { + get { return this._shoppingCartItems; } + set { this._shoppingCartItems.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SpecialOfferProduct.Product - Product.SpecialOfferProducts (m:1)' + public EntitySet SpecialOfferProducts + { + get { return this._specialOfferProducts; } + set { this._specialOfferProducts.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'TransactionHistory.Product - Product.TransactionHistories (m:1)' + public EntitySet TransactionHistories + { + get { return this._transactionHistories; } + set { this._transactionHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Product.UnitMeasure - UnitMeasure.Products (m:1)' + public UnitMeasure UnitMeasure + { + get { return _unitMeasure.Entity; } + set + { + UnitMeasure previousValue = _unitMeasure.Entity; + if((previousValue != value) || (_unitMeasure.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("UnitMeasure"); + if(previousValue != null) + { + _unitMeasure.Entity = null; + previousValue.Products.Remove(this); + } + _unitMeasure.Entity = value; + if(value == null) + { + _sizeUnitMeasureCode = default(System.String); + } + else + { + value.Products.Add(this); + _sizeUnitMeasureCode = value.UnitMeasureCode; + } + this.SendPropertyChanged("UnitMeasure"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Product.UnitMeasure1 - UnitMeasure.Products1 (m:1)' + public UnitMeasure UnitMeasure1 + { + get { return _unitMeasure1.Entity; } + set + { + UnitMeasure previousValue = _unitMeasure1.Entity; + if((previousValue != value) || (_unitMeasure1.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("UnitMeasure1"); + if(previousValue != null) + { + _unitMeasure1.Entity = null; + previousValue.Products1.Remove(this); + } + _unitMeasure1.Entity = value; + if(value == null) + { + _weightUnitMeasureCode = default(System.String); + } + else + { + value.Products1.Add(this); + _weightUnitMeasureCode = value.UnitMeasureCode; + } + this.SendPropertyChanged("UnitMeasure1"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrder.Product - Product.WorkOrders (m:1)' + public EntitySet WorkOrders + { + get { return this._workOrders; } + set { this._workOrders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductCategory.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductCategory.cs new file mode 100644 index 0000000..9c84aaf --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductCategory.cs @@ -0,0 +1,167 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductCategory', mapped on table 'AdventureWorks.Production.ProductCategory'. + public partial class ProductCategory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int32 _productCategoryId; + private System.Guid _rowguid; + private EntitySet _productSubcategories; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnProductCategoryIdChanging(System.Int32 value); + partial void OnProductCategoryIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductCategory() + { + _productSubcategories = new EntitySet(new Action(this.Attach_ProductSubcategories), new Action(this.Detach_ProductSubcategories) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductSubcategories(ProductSubcategory entity) + { + this.SendPropertyChanging("ProductSubcategories"); + entity.ProductCategory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductSubcategories(ProductSubcategory entity) + { + this.SendPropertyChanging("ProductSubcategories"); + entity.ProductCategory = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ProductCategoryId field. Mapped on target field 'ProductCategoryID'. + public System.Int32 ProductCategoryId + { + get { return _productCategoryId; } + set + { + if((_productCategoryId != value)) + { + OnProductCategoryIdChanging(value); + SendPropertyChanging("ProductCategoryId"); + _productCategoryId = value; + SendPropertyChanged("ProductCategoryId"); + OnProductCategoryIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductSubcategory.ProductCategory - ProductCategory.ProductSubcategories (m:1)' + public EntitySet ProductSubcategories + { + get { return this._productSubcategories; } + set { this._productSubcategories.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductCostHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductCostHistory.cs new file mode 100644 index 0000000..4eaa763 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductCostHistory.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductCostHistory', mapped on table 'AdventureWorks.Production.ProductCostHistory'. + public partial class ProductCostHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private Nullable _endDate; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Decimal _standardCost; + private System.DateTime _startDate; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnStandardCostChanging(System.Decimal value); + partial void OnStandardCostChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductCostHistory() + { + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the StandardCost field. Mapped on target field 'StandardCost'. + public System.Decimal StandardCost + { + get { return _standardCost; } + set + { + if((_standardCost != value)) + { + OnStandardCostChanging(value); + SendPropertyChanging("StandardCost"); + _standardCost = value; + SendPropertyChanged("StandardCost"); + OnStandardCostChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductCostHistory.Product - Product.ProductCostHistories (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductCostHistories.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductCostHistories.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductDescription.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductDescription.cs new file mode 100644 index 0000000..36f5461 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductDescription.cs @@ -0,0 +1,167 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductDescription', mapped on table 'AdventureWorks.Production.ProductDescription'. + public partial class ProductDescription : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _description; + private System.DateTime _modifiedDate; + private System.Int32 _productDescriptionId; + private System.Guid _rowguid; + private EntitySet _productModelProductDescriptionCultures; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDescriptionChanging(System.String value); + partial void OnDescriptionChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductDescriptionIdChanging(System.Int32 value); + partial void OnProductDescriptionIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductDescription() + { + _productModelProductDescriptionCultures = new EntitySet(new Action(this.Attach_ProductModelProductDescriptionCultures), new Action(this.Detach_ProductModelProductDescriptionCultures) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.ProductDescription = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.ProductDescription = null; + } + + + #region Class Property Declarations + /// Gets or sets the Description field. Mapped on target field 'Description'. + public System.String Description + { + get { return _description; } + set + { + if((_description != value)) + { + OnDescriptionChanging(value); + SendPropertyChanging("Description"); + _description = value; + SendPropertyChanged("Description"); + OnDescriptionChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductDescriptionId field. Mapped on target field 'ProductDescriptionID'. + public System.Int32 ProductDescriptionId + { + get { return _productDescriptionId; } + set + { + if((_productDescriptionId != value)) + { + OnProductDescriptionIdChanging(value); + SendPropertyChanging("ProductDescriptionId"); + _productDescriptionId = value; + SendPropertyChanged("ProductDescriptionId"); + OnProductDescriptionIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.ProductDescription - ProductDescription.ProductModelProductDescriptionCultures (m:1)' + public EntitySet ProductModelProductDescriptionCultures + { + get { return this._productModelProductDescriptionCultures; } + set { this._productModelProductDescriptionCultures.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductDocument.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductDocument.cs new file mode 100644 index 0000000..e55dbb2 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductDocument.cs @@ -0,0 +1,194 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductDocument', mapped on table 'AdventureWorks.Production.ProductDocument'. + public partial class ProductDocument : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _documentNode; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private EntityRef _document; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDocumentNodeChanging(System.String value); + partial void OnDocumentNodeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductDocument() + { + _document = default(EntityRef); + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the DocumentNode field. Mapped on target field 'DocumentNode'. + public System.String DocumentNode + { + get { return _documentNode; } + set + { + if((_documentNode != value)) + { + if(_document.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnDocumentNodeChanging(value); + SendPropertyChanging("DocumentNode"); + _documentNode = value; + SendPropertyChanged("DocumentNode"); + OnDocumentNodeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductDocument.Document - Document.ProductDocuments (m:1)' + public Document Document + { + get { return _document.Entity; } + set + { + Document previousValue = _document.Entity; + if((previousValue != value) || (_document.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Document"); + if(previousValue != null) + { + _document.Entity = null; + previousValue.ProductDocuments.Remove(this); + } + _document.Entity = value; + if(value == null) + { + _documentNode = default(System.String); + } + else + { + value.ProductDocuments.Add(this); + _documentNode = value.DocumentNode; + } + this.SendPropertyChanged("Document"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductDocument.Product - Product.ProductDocuments (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductDocuments.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductDocuments.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductInventory.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductInventory.cs new file mode 100644 index 0000000..1b1ab59 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductInventory.cs @@ -0,0 +1,274 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductInventory', mapped on table 'AdventureWorks.Production.ProductInventory'. + public partial class ProductInventory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Byte _bin; + private System.Int16 _locationId; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Int16 _quantity; + private System.Guid _rowguid; + private System.String _shelf; + private EntityRef _location; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBinChanging(System.Byte value); + partial void OnBinChanged(); + partial void OnLocationIdChanging(System.Int16 value); + partial void OnLocationIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnQuantityChanging(System.Int16 value); + partial void OnQuantityChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnShelfChanging(System.String value); + partial void OnShelfChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductInventory() + { + _location = default(EntityRef); + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the Bin field. Mapped on target field 'Bin'. + public System.Byte Bin + { + get { return _bin; } + set + { + if((_bin != value)) + { + OnBinChanging(value); + SendPropertyChanging("Bin"); + _bin = value; + SendPropertyChanged("Bin"); + OnBinChanged(); + } + } + } + + /// Gets or sets the LocationId field. Mapped on target field 'LocationID'. + public System.Int16 LocationId + { + get { return _locationId; } + set + { + if((_locationId != value)) + { + if(_location.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnLocationIdChanging(value); + SendPropertyChanging("LocationId"); + _locationId = value; + SendPropertyChanged("LocationId"); + OnLocationIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Quantity field. Mapped on target field 'Quantity'. + public System.Int16 Quantity + { + get { return _quantity; } + set + { + if((_quantity != value)) + { + OnQuantityChanging(value); + SendPropertyChanging("Quantity"); + _quantity = value; + SendPropertyChanged("Quantity"); + OnQuantityChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the Shelf field. Mapped on target field 'Shelf'. + public System.String Shelf + { + get { return _shelf; } + set + { + if((_shelf != value)) + { + OnShelfChanging(value); + SendPropertyChanging("Shelf"); + _shelf = value; + SendPropertyChanged("Shelf"); + OnShelfChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductInventory.Location - Location.ProductInventories (m:1)' + public Location Location + { + get { return _location.Entity; } + set + { + Location previousValue = _location.Entity; + if((previousValue != value) || (_location.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Location"); + if(previousValue != null) + { + _location.Entity = null; + previousValue.ProductInventories.Remove(this); + } + _location.Entity = value; + if(value == null) + { + _locationId = default(System.Int16); + } + else + { + value.ProductInventories.Add(this); + _locationId = value.LocationId; + } + this.SendPropertyChanged("Location"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductInventory.Product - Product.ProductInventories (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductInventories.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductInventories.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductListPriceHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductListPriceHistory.cs new file mode 100644 index 0000000..12b5058 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductListPriceHistory.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductListPriceHistory', mapped on table 'AdventureWorks.Production.ProductListPriceHistory'. + public partial class ProductListPriceHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private Nullable _endDate; + private System.Decimal _listPrice; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.DateTime _startDate; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnListPriceChanging(System.Decimal value); + partial void OnListPriceChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductListPriceHistory() + { + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ListPrice field. Mapped on target field 'ListPrice'. + public System.Decimal ListPrice + { + get { return _listPrice; } + set + { + if((_listPrice != value)) + { + OnListPriceChanging(value); + SendPropertyChanging("ListPrice"); + _listPrice = value; + SendPropertyChanged("ListPrice"); + OnListPriceChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductListPriceHistory.Product - Product.ProductListPriceHistories (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductListPriceHistories.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductListPriceHistories.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductModel.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductModel.cs new file mode 100644 index 0000000..e6e45fa --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductModel.cs @@ -0,0 +1,257 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductModel', mapped on table 'AdventureWorks.Production.ProductModel'. + public partial class ProductModel : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _catalogDescription; + private System.String _instructions; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int32 _productModelId; + private System.Guid _rowguid; + private EntitySet _products; + private EntitySet _productModelIllustrations; + private EntitySet _productModelProductDescriptionCultures; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCatalogDescriptionChanging(System.String value); + partial void OnCatalogDescriptionChanged(); + partial void OnInstructionsChanging(System.String value); + partial void OnInstructionsChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnProductModelIdChanging(System.Int32 value); + partial void OnProductModelIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductModel() + { + _products = new EntitySet(new Action(this.Attach_Products), new Action(this.Detach_Products) ); + _productModelIllustrations = new EntitySet(new Action(this.Attach_ProductModelIllustrations), new Action(this.Detach_ProductModelIllustrations) ); + _productModelProductDescriptionCultures = new EntitySet(new Action(this.Attach_ProductModelProductDescriptionCultures), new Action(this.Detach_ProductModelProductDescriptionCultures) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.ProductModel = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.ProductModel = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductModelIllustrations(ProductModelIllustration entity) + { + this.SendPropertyChanging("ProductModelIllustrations"); + entity.ProductModel = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductModelIllustrations(ProductModelIllustration entity) + { + this.SendPropertyChanging("ProductModelIllustrations"); + entity.ProductModel = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.ProductModel = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductModelProductDescriptionCultures(ProductModelProductDescriptionCulture entity) + { + this.SendPropertyChanging("ProductModelProductDescriptionCultures"); + entity.ProductModel = null; + } + + + #region Class Property Declarations + /// Gets or sets the CatalogDescription field. Mapped on target field 'CatalogDescription'. + public System.String CatalogDescription + { + get { return _catalogDescription; } + set + { + if((_catalogDescription != value)) + { + OnCatalogDescriptionChanging(value); + SendPropertyChanging("CatalogDescription"); + _catalogDescription = value; + SendPropertyChanged("CatalogDescription"); + OnCatalogDescriptionChanged(); + } + } + } + + /// Gets or sets the Instructions field. Mapped on target field 'Instructions'. + public System.String Instructions + { + get { return _instructions; } + set + { + if((_instructions != value)) + { + OnInstructionsChanging(value); + SendPropertyChanging("Instructions"); + _instructions = value; + SendPropertyChanged("Instructions"); + OnInstructionsChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ProductModelId field. Mapped on target field 'ProductModelID'. + public System.Int32 ProductModelId + { + get { return _productModelId; } + set + { + if((_productModelId != value)) + { + OnProductModelIdChanging(value); + SendPropertyChanging("ProductModelId"); + _productModelId = value; + SendPropertyChanged("ProductModelId"); + OnProductModelIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Product.ProductModel - ProductModel.Products (m:1)' + public EntitySet Products + { + get { return this._products; } + set { this._products.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelIllustration.ProductModel - ProductModel.ProductModelIllustrations (m:1)' + public EntitySet ProductModelIllustrations + { + get { return this._productModelIllustrations; } + set { this._productModelIllustrations.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.ProductModel - ProductModel.ProductModelProductDescriptionCultures (m:1)' + public EntitySet ProductModelProductDescriptionCultures + { + get { return this._productModelProductDescriptionCultures; } + set { this._productModelProductDescriptionCultures.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductModelIllustration.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductModelIllustration.cs new file mode 100644 index 0000000..1a0608b --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductModelIllustration.cs @@ -0,0 +1,194 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductModelIllustration', mapped on table 'AdventureWorks.Production.ProductModelIllustration'. + public partial class ProductModelIllustration : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _illustrationId; + private System.DateTime _modifiedDate; + private System.Int32 _productModelId; + private EntityRef _illustration; + private EntityRef _productModel; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIllustrationIdChanging(System.Int32 value); + partial void OnIllustrationIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductModelIdChanging(System.Int32 value); + partial void OnProductModelIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductModelIllustration() + { + _illustration = default(EntityRef); + _productModel = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the IllustrationId field. Mapped on target field 'IllustrationID'. + public System.Int32 IllustrationId + { + get { return _illustrationId; } + set + { + if((_illustrationId != value)) + { + if(_illustration.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnIllustrationIdChanging(value); + SendPropertyChanging("IllustrationId"); + _illustrationId = value; + SendPropertyChanged("IllustrationId"); + OnIllustrationIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductModelId field. Mapped on target field 'ProductModelID'. + public System.Int32 ProductModelId + { + get { return _productModelId; } + set + { + if((_productModelId != value)) + { + if(_productModel.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductModelIdChanging(value); + SendPropertyChanging("ProductModelId"); + _productModelId = value; + SendPropertyChanged("ProductModelId"); + OnProductModelIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelIllustration.Illustration - Illustration.ProductModelIllustrations (m:1)' + public Illustration Illustration + { + get { return _illustration.Entity; } + set + { + Illustration previousValue = _illustration.Entity; + if((previousValue != value) || (_illustration.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Illustration"); + if(previousValue != null) + { + _illustration.Entity = null; + previousValue.ProductModelIllustrations.Remove(this); + } + _illustration.Entity = value; + if(value == null) + { + _illustrationId = default(System.Int32); + } + else + { + value.ProductModelIllustrations.Add(this); + _illustrationId = value.IllustrationId; + } + this.SendPropertyChanged("Illustration"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelIllustration.ProductModel - ProductModel.ProductModelIllustrations (m:1)' + public ProductModel ProductModel + { + get { return _productModel.Entity; } + set + { + ProductModel previousValue = _productModel.Entity; + if((previousValue != value) || (_productModel.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductModel"); + if(previousValue != null) + { + _productModel.Entity = null; + previousValue.ProductModelIllustrations.Remove(this); + } + _productModel.Entity = value; + if(value == null) + { + _productModelId = default(System.Int32); + } + else + { + value.ProductModelIllustrations.Add(this); + _productModelId = value.ProductModelId; + } + this.SendPropertyChanged("ProductModel"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductModelProductDescriptionCulture.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductModelProductDescriptionCulture.cs new file mode 100644 index 0000000..93cf7bb --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductModelProductDescriptionCulture.cs @@ -0,0 +1,250 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductModelProductDescriptionCulture', mapped on table 'AdventureWorks.Production.ProductModelProductDescriptionCulture'. + public partial class ProductModelProductDescriptionCulture : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _cultureId; + private System.DateTime _modifiedDate; + private System.Int32 _productDescriptionId; + private System.Int32 _productModelId; + private EntityRef _culture; + private EntityRef _productDescription; + private EntityRef _productModel; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCultureIdChanging(System.String value); + partial void OnCultureIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductDescriptionIdChanging(System.Int32 value); + partial void OnProductDescriptionIdChanged(); + partial void OnProductModelIdChanging(System.Int32 value); + partial void OnProductModelIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductModelProductDescriptionCulture() + { + _culture = default(EntityRef); + _productDescription = default(EntityRef); + _productModel = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the CultureId field. Mapped on target field 'CultureID'. + public System.String CultureId + { + get { return _cultureId; } + set + { + if((_cultureId != value)) + { + if(_culture.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCultureIdChanging(value); + SendPropertyChanging("CultureId"); + _cultureId = value; + SendPropertyChanged("CultureId"); + OnCultureIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductDescriptionId field. Mapped on target field 'ProductDescriptionID'. + public System.Int32 ProductDescriptionId + { + get { return _productDescriptionId; } + set + { + if((_productDescriptionId != value)) + { + if(_productDescription.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductDescriptionIdChanging(value); + SendPropertyChanging("ProductDescriptionId"); + _productDescriptionId = value; + SendPropertyChanged("ProductDescriptionId"); + OnProductDescriptionIdChanged(); + } + } + } + + /// Gets or sets the ProductModelId field. Mapped on target field 'ProductModelID'. + public System.Int32 ProductModelId + { + get { return _productModelId; } + set + { + if((_productModelId != value)) + { + if(_productModel.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductModelIdChanging(value); + SendPropertyChanging("ProductModelId"); + _productModelId = value; + SendPropertyChanged("ProductModelId"); + OnProductModelIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.Culture - Culture.ProductModelProductDescriptionCultures (m:1)' + public Culture Culture + { + get { return _culture.Entity; } + set + { + Culture previousValue = _culture.Entity; + if((previousValue != value) || (_culture.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Culture"); + if(previousValue != null) + { + _culture.Entity = null; + previousValue.ProductModelProductDescriptionCultures.Remove(this); + } + _culture.Entity = value; + if(value == null) + { + _cultureId = default(System.String); + } + else + { + value.ProductModelProductDescriptionCultures.Add(this); + _cultureId = value.CultureId; + } + this.SendPropertyChanged("Culture"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.ProductDescription - ProductDescription.ProductModelProductDescriptionCultures (m:1)' + public ProductDescription ProductDescription + { + get { return _productDescription.Entity; } + set + { + ProductDescription previousValue = _productDescription.Entity; + if((previousValue != value) || (_productDescription.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductDescription"); + if(previousValue != null) + { + _productDescription.Entity = null; + previousValue.ProductModelProductDescriptionCultures.Remove(this); + } + _productDescription.Entity = value; + if(value == null) + { + _productDescriptionId = default(System.Int32); + } + else + { + value.ProductModelProductDescriptionCultures.Add(this); + _productDescriptionId = value.ProductDescriptionId; + } + this.SendPropertyChanged("ProductDescription"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductModelProductDescriptionCulture.ProductModel - ProductModel.ProductModelProductDescriptionCultures (m:1)' + public ProductModel ProductModel + { + get { return _productModel.Entity; } + set + { + ProductModel previousValue = _productModel.Entity; + if((previousValue != value) || (_productModel.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductModel"); + if(previousValue != null) + { + _productModel.Entity = null; + previousValue.ProductModelProductDescriptionCultures.Remove(this); + } + _productModel.Entity = value; + if(value == null) + { + _productModelId = default(System.Int32); + } + else + { + value.ProductModelProductDescriptionCultures.Add(this); + _productModelId = value.ProductModelId; + } + this.SendPropertyChanged("ProductModel"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductPhoto.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductPhoto.cs new file mode 100644 index 0000000..15f4f52 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductPhoto.cs @@ -0,0 +1,207 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductPhoto', mapped on table 'AdventureWorks.Production.ProductPhoto'. + public partial class ProductPhoto : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Data.Linq.Binary _largePhoto; + private System.String _largePhotoFileName; + private System.DateTime _modifiedDate; + private System.Int32 _productPhotoId; + private System.Data.Linq.Binary _thumbNailPhoto; + private System.String _thumbnailPhotoFileName; + private EntitySet _productProductPhotos; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnLargePhotoChanging(System.Data.Linq.Binary value); + partial void OnLargePhotoChanged(); + partial void OnLargePhotoFileNameChanging(System.String value); + partial void OnLargePhotoFileNameChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductPhotoIdChanging(System.Int32 value); + partial void OnProductPhotoIdChanged(); + partial void OnThumbNailPhotoChanging(System.Data.Linq.Binary value); + partial void OnThumbNailPhotoChanged(); + partial void OnThumbnailPhotoFileNameChanging(System.String value); + partial void OnThumbnailPhotoFileNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductPhoto() + { + _productProductPhotos = new EntitySet(new Action(this.Attach_ProductProductPhotos), new Action(this.Detach_ProductProductPhotos) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductProductPhotos(ProductProductPhoto entity) + { + this.SendPropertyChanging("ProductProductPhotos"); + entity.ProductPhoto = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductProductPhotos(ProductProductPhoto entity) + { + this.SendPropertyChanging("ProductProductPhotos"); + entity.ProductPhoto = null; + } + + + #region Class Property Declarations + /// Gets or sets the LargePhoto field. Mapped on target field 'LargePhoto'. + public System.Data.Linq.Binary LargePhoto + { + get { return _largePhoto; } + set + { + if((_largePhoto != value)) + { + OnLargePhotoChanging(value); + SendPropertyChanging("LargePhoto"); + _largePhoto = value; + SendPropertyChanged("LargePhoto"); + OnLargePhotoChanged(); + } + } + } + + /// Gets or sets the LargePhotoFileName field. Mapped on target field 'LargePhotoFileName'. + public System.String LargePhotoFileName + { + get { return _largePhotoFileName; } + set + { + if((_largePhotoFileName != value)) + { + OnLargePhotoFileNameChanging(value); + SendPropertyChanging("LargePhotoFileName"); + _largePhotoFileName = value; + SendPropertyChanged("LargePhotoFileName"); + OnLargePhotoFileNameChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductPhotoId field. Mapped on target field 'ProductPhotoID'. + public System.Int32 ProductPhotoId + { + get { return _productPhotoId; } + set + { + if((_productPhotoId != value)) + { + OnProductPhotoIdChanging(value); + SendPropertyChanging("ProductPhotoId"); + _productPhotoId = value; + SendPropertyChanged("ProductPhotoId"); + OnProductPhotoIdChanged(); + } + } + } + + /// Gets or sets the ThumbNailPhoto field. Mapped on target field 'ThumbNailPhoto'. + public System.Data.Linq.Binary ThumbNailPhoto + { + get { return _thumbNailPhoto; } + set + { + if((_thumbNailPhoto != value)) + { + OnThumbNailPhotoChanging(value); + SendPropertyChanging("ThumbNailPhoto"); + _thumbNailPhoto = value; + SendPropertyChanged("ThumbNailPhoto"); + OnThumbNailPhotoChanged(); + } + } + } + + /// Gets or sets the ThumbnailPhotoFileName field. Mapped on target field 'ThumbnailPhotoFileName'. + public System.String ThumbnailPhotoFileName + { + get { return _thumbnailPhotoFileName; } + set + { + if((_thumbnailPhotoFileName != value)) + { + OnThumbnailPhotoFileNameChanging(value); + SendPropertyChanging("ThumbnailPhotoFileName"); + _thumbnailPhotoFileName = value; + SendPropertyChanged("ThumbnailPhotoFileName"); + OnThumbnailPhotoFileNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductProductPhoto.ProductPhoto - ProductPhoto.ProductProductPhotos (m:1)' + public EntitySet ProductProductPhotos + { + get { return this._productProductPhotos; } + set { this._productProductPhotos.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductProductPhoto.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductProductPhoto.cs new file mode 100644 index 0000000..46bae31 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductProductPhoto.cs @@ -0,0 +1,214 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductProductPhoto', mapped on table 'AdventureWorks.Production.ProductProductPhoto'. + public partial class ProductProductPhoto : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.Boolean _primary; + private System.Int32 _productId; + private System.Int32 _productPhotoId; + private EntityRef _product; + private EntityRef _productPhoto; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnPrimaryChanging(System.Boolean value); + partial void OnPrimaryChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnProductPhotoIdChanging(System.Int32 value); + partial void OnProductPhotoIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductProductPhoto() + { + _product = default(EntityRef); + _productPhoto = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Primary field. Mapped on target field 'Primary'. + public System.Boolean Primary + { + get { return _primary; } + set + { + if((_primary != value)) + { + OnPrimaryChanging(value); + SendPropertyChanging("Primary"); + _primary = value; + SendPropertyChanged("Primary"); + OnPrimaryChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the ProductPhotoId field. Mapped on target field 'ProductPhotoID'. + public System.Int32 ProductPhotoId + { + get { return _productPhotoId; } + set + { + if((_productPhotoId != value)) + { + if(_productPhoto.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductPhotoIdChanging(value); + SendPropertyChanging("ProductPhotoId"); + _productPhotoId = value; + SendPropertyChanged("ProductPhotoId"); + OnProductPhotoIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductProductPhoto.Product - Product.ProductProductPhotos (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductProductPhotos.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductProductPhotos.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductProductPhoto.ProductPhoto - ProductPhoto.ProductProductPhotos (m:1)' + public ProductPhoto ProductPhoto + { + get { return _productPhoto.Entity; } + set + { + ProductPhoto previousValue = _productPhoto.Entity; + if((previousValue != value) || (_productPhoto.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductPhoto"); + if(previousValue != null) + { + _productPhoto.Entity = null; + previousValue.ProductProductPhotos.Remove(this); + } + _productPhoto.Entity = value; + if(value == null) + { + _productPhotoId = default(System.Int32); + } + else + { + value.ProductProductPhotos.Add(this); + _productPhotoId = value.ProductPhotoId; + } + this.SendPropertyChanged("ProductPhoto"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductReview.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductReview.cs new file mode 100644 index 0000000..a6a19d6 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductReview.cs @@ -0,0 +1,258 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductReview', mapped on table 'AdventureWorks.Production.ProductReview'. + public partial class ProductReview : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _comments; + private System.String _emailAddress; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Int32 _productReviewId; + private System.Int32 _rating; + private System.DateTime _reviewDate; + private System.String _reviewerName; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCommentsChanging(System.String value); + partial void OnCommentsChanged(); + partial void OnEmailAddressChanging(System.String value); + partial void OnEmailAddressChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnProductReviewIdChanging(System.Int32 value); + partial void OnProductReviewIdChanged(); + partial void OnRatingChanging(System.Int32 value); + partial void OnRatingChanged(); + partial void OnReviewDateChanging(System.DateTime value); + partial void OnReviewDateChanged(); + partial void OnReviewerNameChanging(System.String value); + partial void OnReviewerNameChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductReview() + { + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the Comments field. Mapped on target field 'Comments'. + public System.String Comments + { + get { return _comments; } + set + { + if((_comments != value)) + { + OnCommentsChanging(value); + SendPropertyChanging("Comments"); + _comments = value; + SendPropertyChanged("Comments"); + OnCommentsChanged(); + } + } + } + + /// Gets or sets the EmailAddress field. Mapped on target field 'EmailAddress'. + public System.String EmailAddress + { + get { return _emailAddress; } + set + { + if((_emailAddress != value)) + { + OnEmailAddressChanging(value); + SendPropertyChanging("EmailAddress"); + _emailAddress = value; + SendPropertyChanged("EmailAddress"); + OnEmailAddressChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the ProductReviewId field. Mapped on target field 'ProductReviewID'. + public System.Int32 ProductReviewId + { + get { return _productReviewId; } + set + { + if((_productReviewId != value)) + { + OnProductReviewIdChanging(value); + SendPropertyChanging("ProductReviewId"); + _productReviewId = value; + SendPropertyChanged("ProductReviewId"); + OnProductReviewIdChanged(); + } + } + } + + /// Gets or sets the Rating field. Mapped on target field 'Rating'. + public System.Int32 Rating + { + get { return _rating; } + set + { + if((_rating != value)) + { + OnRatingChanging(value); + SendPropertyChanging("Rating"); + _rating = value; + SendPropertyChanged("Rating"); + OnRatingChanged(); + } + } + } + + /// Gets or sets the ReviewDate field. Mapped on target field 'ReviewDate'. + public System.DateTime ReviewDate + { + get { return _reviewDate; } + set + { + if((_reviewDate != value)) + { + OnReviewDateChanging(value); + SendPropertyChanging("ReviewDate"); + _reviewDate = value; + SendPropertyChanged("ReviewDate"); + OnReviewDateChanged(); + } + } + } + + /// Gets or sets the ReviewerName field. Mapped on target field 'ReviewerName'. + public System.String ReviewerName + { + get { return _reviewerName; } + set + { + if((_reviewerName != value)) + { + OnReviewerNameChanging(value); + SendPropertyChanging("ReviewerName"); + _reviewerName = value; + SendPropertyChanged("ReviewerName"); + OnReviewerNameChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductReview.Product - Product.ProductReviews (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductReviews.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductReviews.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductSubcategory.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductSubcategory.cs new file mode 100644 index 0000000..4585f8e --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductSubcategory.cs @@ -0,0 +1,223 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductSubcategory', mapped on table 'AdventureWorks.Production.ProductSubcategory'. + public partial class ProductSubcategory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int32 _productCategoryId; + private System.Int32 _productSubcategoryId; + private System.Guid _rowguid; + private EntitySet _products; + private EntityRef _productCategory; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnProductCategoryIdChanging(System.Int32 value); + partial void OnProductCategoryIdChanged(); + partial void OnProductSubcategoryIdChanging(System.Int32 value); + partial void OnProductSubcategoryIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductSubcategory() + { + _products = new EntitySet(new Action(this.Attach_Products), new Action(this.Detach_Products) ); + _productCategory = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.ProductSubcategory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.ProductSubcategory = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ProductCategoryId field. Mapped on target field 'ProductCategoryID'. + public System.Int32 ProductCategoryId + { + get { return _productCategoryId; } + set + { + if((_productCategoryId != value)) + { + if(_productCategory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductCategoryIdChanging(value); + SendPropertyChanging("ProductCategoryId"); + _productCategoryId = value; + SendPropertyChanged("ProductCategoryId"); + OnProductCategoryIdChanged(); + } + } + } + + /// Gets or sets the ProductSubcategoryId field. Mapped on target field 'ProductSubcategoryID'. + public System.Int32 ProductSubcategoryId + { + get { return _productSubcategoryId; } + set + { + if((_productSubcategoryId != value)) + { + OnProductSubcategoryIdChanging(value); + SendPropertyChanging("ProductSubcategoryId"); + _productSubcategoryId = value; + SendPropertyChanged("ProductSubcategoryId"); + OnProductSubcategoryIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Product.ProductSubcategory - ProductSubcategory.Products (m:1)' + public EntitySet Products + { + get { return this._products; } + set { this._products.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductSubcategory.ProductCategory - ProductCategory.ProductSubcategories (m:1)' + public ProductCategory ProductCategory + { + get { return _productCategory.Entity; } + set + { + ProductCategory previousValue = _productCategory.Entity; + if((previousValue != value) || (_productCategory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ProductCategory"); + if(previousValue != null) + { + _productCategory.Entity = null; + previousValue.ProductSubcategories.Remove(this); + } + _productCategory.Entity = value; + if(value == null) + { + _productCategoryId = default(System.Int32); + } + else + { + value.ProductSubcategories.Add(this); + _productCategoryId = value.ProductCategoryId; + } + this.SendPropertyChanged("ProductCategory"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ProductVendor.cs b/tests/AdventureWorks2008Model/EntityClasses/ProductVendor.cs new file mode 100644 index 0000000..21763f9 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ProductVendor.cs @@ -0,0 +1,390 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ProductVendor', mapped on table 'AdventureWorks.Purchasing.ProductVendor'. + public partial class ProductVendor : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _averageLeadTime; + private System.Int32 _businessEntityId; + private Nullable _lastReceiptCost; + private Nullable _lastReceiptDate; + private System.Int32 _maxOrderQty; + private System.Int32 _minOrderQty; + private System.DateTime _modifiedDate; + private Nullable _onOrderQty; + private System.Int32 _productId; + private System.Decimal _standardPrice; + private System.String _unitMeasureCode; + private EntityRef _product; + private EntityRef _unitMeasure; + private EntityRef _vendor; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAverageLeadTimeChanging(System.Int32 value); + partial void OnAverageLeadTimeChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnLastReceiptCostChanging(Nullable value); + partial void OnLastReceiptCostChanged(); + partial void OnLastReceiptDateChanging(Nullable value); + partial void OnLastReceiptDateChanged(); + partial void OnMaxOrderQtyChanging(System.Int32 value); + partial void OnMaxOrderQtyChanged(); + partial void OnMinOrderQtyChanging(System.Int32 value); + partial void OnMinOrderQtyChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOnOrderQtyChanging(Nullable value); + partial void OnOnOrderQtyChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnStandardPriceChanging(System.Decimal value); + partial void OnStandardPriceChanged(); + partial void OnUnitMeasureCodeChanging(System.String value); + partial void OnUnitMeasureCodeChanged(); + #endregion + + /// Initializes a new instance of the class. + public ProductVendor() + { + _product = default(EntityRef); + _unitMeasure = default(EntityRef); + _vendor = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the AverageLeadTime field. Mapped on target field 'AverageLeadTime'. + public System.Int32 AverageLeadTime + { + get { return _averageLeadTime; } + set + { + if((_averageLeadTime != value)) + { + OnAverageLeadTimeChanging(value); + SendPropertyChanging("AverageLeadTime"); + _averageLeadTime = value; + SendPropertyChanged("AverageLeadTime"); + OnAverageLeadTimeChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_vendor.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the LastReceiptCost field. Mapped on target field 'LastReceiptCost'. + public Nullable LastReceiptCost + { + get { return _lastReceiptCost; } + set + { + if((_lastReceiptCost != value)) + { + OnLastReceiptCostChanging(value); + SendPropertyChanging("LastReceiptCost"); + _lastReceiptCost = value; + SendPropertyChanged("LastReceiptCost"); + OnLastReceiptCostChanged(); + } + } + } + + /// Gets or sets the LastReceiptDate field. Mapped on target field 'LastReceiptDate'. + public Nullable LastReceiptDate + { + get { return _lastReceiptDate; } + set + { + if((_lastReceiptDate != value)) + { + OnLastReceiptDateChanging(value); + SendPropertyChanging("LastReceiptDate"); + _lastReceiptDate = value; + SendPropertyChanged("LastReceiptDate"); + OnLastReceiptDateChanged(); + } + } + } + + /// Gets or sets the MaxOrderQty field. Mapped on target field 'MaxOrderQty'. + public System.Int32 MaxOrderQty + { + get { return _maxOrderQty; } + set + { + if((_maxOrderQty != value)) + { + OnMaxOrderQtyChanging(value); + SendPropertyChanging("MaxOrderQty"); + _maxOrderQty = value; + SendPropertyChanged("MaxOrderQty"); + OnMaxOrderQtyChanged(); + } + } + } + + /// Gets or sets the MinOrderQty field. Mapped on target field 'MinOrderQty'. + public System.Int32 MinOrderQty + { + get { return _minOrderQty; } + set + { + if((_minOrderQty != value)) + { + OnMinOrderQtyChanging(value); + SendPropertyChanging("MinOrderQty"); + _minOrderQty = value; + SendPropertyChanged("MinOrderQty"); + OnMinOrderQtyChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OnOrderQty field. Mapped on target field 'OnOrderQty'. + public Nullable OnOrderQty + { + get { return _onOrderQty; } + set + { + if((_onOrderQty != value)) + { + OnOnOrderQtyChanging(value); + SendPropertyChanging("OnOrderQty"); + _onOrderQty = value; + SendPropertyChanged("OnOrderQty"); + OnOnOrderQtyChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the StandardPrice field. Mapped on target field 'StandardPrice'. + public System.Decimal StandardPrice + { + get { return _standardPrice; } + set + { + if((_standardPrice != value)) + { + OnStandardPriceChanging(value); + SendPropertyChanging("StandardPrice"); + _standardPrice = value; + SendPropertyChanged("StandardPrice"); + OnStandardPriceChanged(); + } + } + } + + /// Gets or sets the UnitMeasureCode field. Mapped on target field 'UnitMeasureCode'. + public System.String UnitMeasureCode + { + get { return _unitMeasureCode; } + set + { + if((_unitMeasureCode != value)) + { + if(_unitMeasure.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnUnitMeasureCodeChanging(value); + SendPropertyChanging("UnitMeasureCode"); + _unitMeasureCode = value; + SendPropertyChanged("UnitMeasureCode"); + OnUnitMeasureCodeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.Product - Product.ProductVendors (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ProductVendors.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ProductVendors.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.UnitMeasure - UnitMeasure.ProductVendors (m:1)' + public UnitMeasure UnitMeasure + { + get { return _unitMeasure.Entity; } + set + { + UnitMeasure previousValue = _unitMeasure.Entity; + if((previousValue != value) || (_unitMeasure.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("UnitMeasure"); + if(previousValue != null) + { + _unitMeasure.Entity = null; + previousValue.ProductVendors.Remove(this); + } + _unitMeasure.Entity = value; + if(value == null) + { + _unitMeasureCode = default(System.String); + } + else + { + value.ProductVendors.Add(this); + _unitMeasureCode = value.UnitMeasureCode; + } + this.SendPropertyChanged("UnitMeasure"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.Vendor - Vendor.ProductVendors (m:1)' + public Vendor Vendor + { + get { return _vendor.Entity; } + set + { + Vendor previousValue = _vendor.Entity; + if((previousValue != value) || (_vendor.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Vendor"); + if(previousValue != null) + { + _vendor.Entity = null; + previousValue.ProductVendors.Remove(this); + } + _vendor.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.ProductVendors.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Vendor"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderDetail.cs b/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderDetail.cs new file mode 100644 index 0000000..0047546 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderDetail.cs @@ -0,0 +1,332 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'PurchaseOrderDetail', mapped on table 'AdventureWorks.Purchasing.PurchaseOrderDetail'. + public partial class PurchaseOrderDetail : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _dueDate; + private System.Decimal _lineTotal; + private System.DateTime _modifiedDate; + private System.Int16 _orderQty; + private System.Int32 _productId; + private System.Int32 _purchaseOrderDetailId; + private System.Int32 _purchaseOrderId; + private System.Decimal _receivedQty; + private System.Decimal _rejectedQty; + private System.Decimal _stockedQty; + private System.Decimal _unitPrice; + private EntityRef _product; + private EntityRef _purchaseOrderHeader; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDueDateChanging(System.DateTime value); + partial void OnDueDateChanged(); + partial void OnLineTotalChanging(System.Decimal value); + partial void OnLineTotalChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOrderQtyChanging(System.Int16 value); + partial void OnOrderQtyChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnPurchaseOrderDetailIdChanging(System.Int32 value); + partial void OnPurchaseOrderDetailIdChanged(); + partial void OnPurchaseOrderIdChanging(System.Int32 value); + partial void OnPurchaseOrderIdChanged(); + partial void OnReceivedQtyChanging(System.Decimal value); + partial void OnReceivedQtyChanged(); + partial void OnRejectedQtyChanging(System.Decimal value); + partial void OnRejectedQtyChanged(); + partial void OnStockedQtyChanging(System.Decimal value); + partial void OnStockedQtyChanged(); + partial void OnUnitPriceChanging(System.Decimal value); + partial void OnUnitPriceChanged(); + #endregion + + /// Initializes a new instance of the class. + public PurchaseOrderDetail() + { + _product = default(EntityRef); + _purchaseOrderHeader = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the DueDate field. Mapped on target field 'DueDate'. + public System.DateTime DueDate + { + get { return _dueDate; } + set + { + if((_dueDate != value)) + { + OnDueDateChanging(value); + SendPropertyChanging("DueDate"); + _dueDate = value; + SendPropertyChanged("DueDate"); + OnDueDateChanged(); + } + } + } + + /// Gets or sets the LineTotal field. Mapped on target field 'LineTotal'. + public System.Decimal LineTotal + { + get { return _lineTotal; } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OrderQty field. Mapped on target field 'OrderQty'. + public System.Int16 OrderQty + { + get { return _orderQty; } + set + { + if((_orderQty != value)) + { + OnOrderQtyChanging(value); + SendPropertyChanging("OrderQty"); + _orderQty = value; + SendPropertyChanged("OrderQty"); + OnOrderQtyChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the PurchaseOrderDetailId field. Mapped on target field 'PurchaseOrderDetailID'. + public System.Int32 PurchaseOrderDetailId + { + get { return _purchaseOrderDetailId; } + set + { + if((_purchaseOrderDetailId != value)) + { + OnPurchaseOrderDetailIdChanging(value); + SendPropertyChanging("PurchaseOrderDetailId"); + _purchaseOrderDetailId = value; + SendPropertyChanged("PurchaseOrderDetailId"); + OnPurchaseOrderDetailIdChanged(); + } + } + } + + /// Gets or sets the PurchaseOrderId field. Mapped on target field 'PurchaseOrderID'. + public System.Int32 PurchaseOrderId + { + get { return _purchaseOrderId; } + set + { + if((_purchaseOrderId != value)) + { + if(_purchaseOrderHeader.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnPurchaseOrderIdChanging(value); + SendPropertyChanging("PurchaseOrderId"); + _purchaseOrderId = value; + SendPropertyChanged("PurchaseOrderId"); + OnPurchaseOrderIdChanged(); + } + } + } + + /// Gets or sets the ReceivedQty field. Mapped on target field 'ReceivedQty'. + public System.Decimal ReceivedQty + { + get { return _receivedQty; } + set + { + if((_receivedQty != value)) + { + OnReceivedQtyChanging(value); + SendPropertyChanging("ReceivedQty"); + _receivedQty = value; + SendPropertyChanged("ReceivedQty"); + OnReceivedQtyChanged(); + } + } + } + + /// Gets or sets the RejectedQty field. Mapped on target field 'RejectedQty'. + public System.Decimal RejectedQty + { + get { return _rejectedQty; } + set + { + if((_rejectedQty != value)) + { + OnRejectedQtyChanging(value); + SendPropertyChanging("RejectedQty"); + _rejectedQty = value; + SendPropertyChanged("RejectedQty"); + OnRejectedQtyChanged(); + } + } + } + + /// Gets or sets the StockedQty field. Mapped on target field 'StockedQty'. + public System.Decimal StockedQty + { + get { return _stockedQty; } + } + + /// Gets or sets the UnitPrice field. Mapped on target field 'UnitPrice'. + public System.Decimal UnitPrice + { + get { return _unitPrice; } + set + { + if((_unitPrice != value)) + { + OnUnitPriceChanging(value); + SendPropertyChanging("UnitPrice"); + _unitPrice = value; + SendPropertyChanged("UnitPrice"); + OnUnitPriceChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderDetail.Product - Product.PurchaseOrderDetails (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.PurchaseOrderDetails.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.PurchaseOrderDetails.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderDetail.PurchaseOrderHeader - PurchaseOrderHeader.PurchaseOrderDetails (m:1)' + public PurchaseOrderHeader PurchaseOrderHeader + { + get { return _purchaseOrderHeader.Entity; } + set + { + PurchaseOrderHeader previousValue = _purchaseOrderHeader.Entity; + if((previousValue != value) || (_purchaseOrderHeader.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("PurchaseOrderHeader"); + if(previousValue != null) + { + _purchaseOrderHeader.Entity = null; + previousValue.PurchaseOrderDetails.Remove(this); + } + _purchaseOrderHeader.Entity = value; + if(value == null) + { + _purchaseOrderId = default(System.Int32); + } + else + { + value.PurchaseOrderDetails.Add(this); + _purchaseOrderId = value.PurchaseOrderId; + } + this.SendPropertyChanged("PurchaseOrderHeader"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderHeader.cs b/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderHeader.cs new file mode 100644 index 0000000..470b5b7 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/PurchaseOrderHeader.cs @@ -0,0 +1,444 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'PurchaseOrderHeader', mapped on table 'AdventureWorks.Purchasing.PurchaseOrderHeader'. + public partial class PurchaseOrderHeader : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _employeeId; + private System.Decimal _freight; + private System.DateTime _modifiedDate; + private System.DateTime _orderDate; + private System.Int32 _purchaseOrderId; + private System.Byte _revisionNumber; + private Nullable _shipDate; + private System.Int32 _shipMethodId; + private System.Byte _status; + private System.Decimal _subTotal; + private System.Decimal _taxAmt; + private System.Decimal _totalDue; + private System.Int32 _vendorId; + private EntityRef _employee; + private EntitySet _purchaseOrderDetails; + private EntityRef _shipMethod; + private EntityRef _vendor; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEmployeeIdChanging(System.Int32 value); + partial void OnEmployeeIdChanged(); + partial void OnFreightChanging(System.Decimal value); + partial void OnFreightChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOrderDateChanging(System.DateTime value); + partial void OnOrderDateChanged(); + partial void OnPurchaseOrderIdChanging(System.Int32 value); + partial void OnPurchaseOrderIdChanged(); + partial void OnRevisionNumberChanging(System.Byte value); + partial void OnRevisionNumberChanged(); + partial void OnShipDateChanging(Nullable value); + partial void OnShipDateChanged(); + partial void OnShipMethodIdChanging(System.Int32 value); + partial void OnShipMethodIdChanged(); + partial void OnStatusChanging(System.Byte value); + partial void OnStatusChanged(); + partial void OnSubTotalChanging(System.Decimal value); + partial void OnSubTotalChanged(); + partial void OnTaxAmtChanging(System.Decimal value); + partial void OnTaxAmtChanged(); + partial void OnTotalDueChanging(System.Decimal value); + partial void OnTotalDueChanged(); + partial void OnVendorIdChanging(System.Int32 value); + partial void OnVendorIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public PurchaseOrderHeader() + { + _employee = default(EntityRef); + _purchaseOrderDetails = new EntitySet(new Action(this.Attach_PurchaseOrderDetails), new Action(this.Detach_PurchaseOrderDetails) ); + _shipMethod = default(EntityRef); + _vendor = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PurchaseOrderDetails(PurchaseOrderDetail entity) + { + this.SendPropertyChanging("PurchaseOrderDetails"); + entity.PurchaseOrderHeader = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PurchaseOrderDetails(PurchaseOrderDetail entity) + { + this.SendPropertyChanging("PurchaseOrderDetails"); + entity.PurchaseOrderHeader = null; + } + + + #region Class Property Declarations + /// Gets or sets the EmployeeId field. Mapped on target field 'EmployeeID'. + public System.Int32 EmployeeId + { + get { return _employeeId; } + set + { + if((_employeeId != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnEmployeeIdChanging(value); + SendPropertyChanging("EmployeeId"); + _employeeId = value; + SendPropertyChanged("EmployeeId"); + OnEmployeeIdChanged(); + } + } + } + + /// Gets or sets the Freight field. Mapped on target field 'Freight'. + public System.Decimal Freight + { + get { return _freight; } + set + { + if((_freight != value)) + { + OnFreightChanging(value); + SendPropertyChanging("Freight"); + _freight = value; + SendPropertyChanged("Freight"); + OnFreightChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OrderDate field. Mapped on target field 'OrderDate'. + public System.DateTime OrderDate + { + get { return _orderDate; } + set + { + if((_orderDate != value)) + { + OnOrderDateChanging(value); + SendPropertyChanging("OrderDate"); + _orderDate = value; + SendPropertyChanged("OrderDate"); + OnOrderDateChanged(); + } + } + } + + /// Gets or sets the PurchaseOrderId field. Mapped on target field 'PurchaseOrderID'. + public System.Int32 PurchaseOrderId + { + get { return _purchaseOrderId; } + set + { + if((_purchaseOrderId != value)) + { + OnPurchaseOrderIdChanging(value); + SendPropertyChanging("PurchaseOrderId"); + _purchaseOrderId = value; + SendPropertyChanged("PurchaseOrderId"); + OnPurchaseOrderIdChanged(); + } + } + } + + /// Gets or sets the RevisionNumber field. Mapped on target field 'RevisionNumber'. + public System.Byte RevisionNumber + { + get { return _revisionNumber; } + set + { + if((_revisionNumber != value)) + { + OnRevisionNumberChanging(value); + SendPropertyChanging("RevisionNumber"); + _revisionNumber = value; + SendPropertyChanged("RevisionNumber"); + OnRevisionNumberChanged(); + } + } + } + + /// Gets or sets the ShipDate field. Mapped on target field 'ShipDate'. + public Nullable ShipDate + { + get { return _shipDate; } + set + { + if((_shipDate != value)) + { + OnShipDateChanging(value); + SendPropertyChanging("ShipDate"); + _shipDate = value; + SendPropertyChanged("ShipDate"); + OnShipDateChanged(); + } + } + } + + /// Gets or sets the ShipMethodId field. Mapped on target field 'ShipMethodID'. + public System.Int32 ShipMethodId + { + get { return _shipMethodId; } + set + { + if((_shipMethodId != value)) + { + if(_shipMethod.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnShipMethodIdChanging(value); + SendPropertyChanging("ShipMethodId"); + _shipMethodId = value; + SendPropertyChanged("ShipMethodId"); + OnShipMethodIdChanged(); + } + } + } + + /// Gets or sets the Status field. Mapped on target field 'Status'. + public System.Byte Status + { + get { return _status; } + set + { + if((_status != value)) + { + OnStatusChanging(value); + SendPropertyChanging("Status"); + _status = value; + SendPropertyChanged("Status"); + OnStatusChanged(); + } + } + } + + /// Gets or sets the SubTotal field. Mapped on target field 'SubTotal'. + public System.Decimal SubTotal + { + get { return _subTotal; } + set + { + if((_subTotal != value)) + { + OnSubTotalChanging(value); + SendPropertyChanging("SubTotal"); + _subTotal = value; + SendPropertyChanged("SubTotal"); + OnSubTotalChanged(); + } + } + } + + /// Gets or sets the TaxAmt field. Mapped on target field 'TaxAmt'. + public System.Decimal TaxAmt + { + get { return _taxAmt; } + set + { + if((_taxAmt != value)) + { + OnTaxAmtChanging(value); + SendPropertyChanging("TaxAmt"); + _taxAmt = value; + SendPropertyChanged("TaxAmt"); + OnTaxAmtChanged(); + } + } + } + + /// Gets or sets the TotalDue field. Mapped on target field 'TotalDue'. + public System.Decimal TotalDue + { + get { return _totalDue; } + } + + /// Gets or sets the VendorId field. Mapped on target field 'VendorID'. + public System.Int32 VendorId + { + get { return _vendorId; } + set + { + if((_vendorId != value)) + { + if(_vendor.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnVendorIdChanging(value); + SendPropertyChanging("VendorId"); + _vendorId = value; + SendPropertyChanged("VendorId"); + OnVendorIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.Employee - Employee.PurchaseOrderHeaders (m:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.PurchaseOrderHeaders.Remove(this); + } + _employee.Entity = value; + if(value == null) + { + _employeeId = default(System.Int32); + } + else + { + value.PurchaseOrderHeaders.Add(this); + _employeeId = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderDetail.PurchaseOrderHeader - PurchaseOrderHeader.PurchaseOrderDetails (m:1)' + public EntitySet PurchaseOrderDetails + { + get { return this._purchaseOrderDetails; } + set { this._purchaseOrderDetails.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.ShipMethod - ShipMethod.PurchaseOrderHeaders (m:1)' + public ShipMethod ShipMethod + { + get { return _shipMethod.Entity; } + set + { + ShipMethod previousValue = _shipMethod.Entity; + if((previousValue != value) || (_shipMethod.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ShipMethod"); + if(previousValue != null) + { + _shipMethod.Entity = null; + previousValue.PurchaseOrderHeaders.Remove(this); + } + _shipMethod.Entity = value; + if(value == null) + { + _shipMethodId = default(System.Int32); + } + else + { + value.PurchaseOrderHeaders.Add(this); + _shipMethodId = value.ShipMethodId; + } + this.SendPropertyChanged("ShipMethod"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.Vendor - Vendor.PurchaseOrderHeaders (m:1)' + public Vendor Vendor + { + get { return _vendor.Entity; } + set + { + Vendor previousValue = _vendor.Entity; + if((previousValue != value) || (_vendor.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Vendor"); + if(previousValue != null) + { + _vendor.Entity = null; + previousValue.PurchaseOrderHeaders.Remove(this); + } + _vendor.Entity = value; + if(value == null) + { + _vendorId = default(System.Int32); + } + else + { + value.PurchaseOrderHeaders.Add(this); + _vendorId = value.BusinessEntityId; + } + this.SendPropertyChanged("Vendor"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesOrderDetail.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderDetail.cs new file mode 100644 index 0000000..b483570 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderDetail.cs @@ -0,0 +1,349 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesOrderDetail', mapped on table 'AdventureWorks.Sales.SalesOrderDetail'. + public partial class SalesOrderDetail : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _carrierTrackingNumber; + private System.Decimal _lineTotal; + private System.DateTime _modifiedDate; + private System.Int16 _orderQty; + private System.Int32 _productId; + private System.Guid _rowguid; + private System.Int32 _salesOrderDetailId; + private System.Int32 _salesOrderId; + private System.Int32 _specialOfferId; + private System.Decimal _unitPrice; + private System.Decimal _unitPriceDiscount; + private EntityRef _salesOrderHeader; + private EntityRef _specialOfferProduct; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCarrierTrackingNumberChanging(System.String value); + partial void OnCarrierTrackingNumberChanged(); + partial void OnLineTotalChanging(System.Decimal value); + partial void OnLineTotalChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOrderQtyChanging(System.Int16 value); + partial void OnOrderQtyChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesOrderDetailIdChanging(System.Int32 value); + partial void OnSalesOrderDetailIdChanged(); + partial void OnSalesOrderIdChanging(System.Int32 value); + partial void OnSalesOrderIdChanged(); + partial void OnSpecialOfferIdChanging(System.Int32 value); + partial void OnSpecialOfferIdChanged(); + partial void OnUnitPriceChanging(System.Decimal value); + partial void OnUnitPriceChanged(); + partial void OnUnitPriceDiscountChanging(System.Decimal value); + partial void OnUnitPriceDiscountChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesOrderDetail() + { + _salesOrderHeader = default(EntityRef); + _specialOfferProduct = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the CarrierTrackingNumber field. Mapped on target field 'CarrierTrackingNumber'. + public System.String CarrierTrackingNumber + { + get { return _carrierTrackingNumber; } + set + { + if((_carrierTrackingNumber != value)) + { + OnCarrierTrackingNumberChanging(value); + SendPropertyChanging("CarrierTrackingNumber"); + _carrierTrackingNumber = value; + SendPropertyChanged("CarrierTrackingNumber"); + OnCarrierTrackingNumberChanged(); + } + } + } + + /// Gets or sets the LineTotal field. Mapped on target field 'LineTotal'. + public System.Decimal LineTotal + { + get { return _lineTotal; } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OrderQty field. Mapped on target field 'OrderQty'. + public System.Int16 OrderQty + { + get { return _orderQty; } + set + { + if((_orderQty != value)) + { + OnOrderQtyChanging(value); + SendPropertyChanging("OrderQty"); + _orderQty = value; + SendPropertyChanged("OrderQty"); + OnOrderQtyChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_specialOfferProduct.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesOrderDetailId field. Mapped on target field 'SalesOrderDetailID'. + public System.Int32 SalesOrderDetailId + { + get { return _salesOrderDetailId; } + set + { + if((_salesOrderDetailId != value)) + { + OnSalesOrderDetailIdChanging(value); + SendPropertyChanging("SalesOrderDetailId"); + _salesOrderDetailId = value; + SendPropertyChanged("SalesOrderDetailId"); + OnSalesOrderDetailIdChanged(); + } + } + } + + /// Gets or sets the SalesOrderId field. Mapped on target field 'SalesOrderID'. + public System.Int32 SalesOrderId + { + get { return _salesOrderId; } + set + { + if((_salesOrderId != value)) + { + if(_salesOrderHeader.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSalesOrderIdChanging(value); + SendPropertyChanging("SalesOrderId"); + _salesOrderId = value; + SendPropertyChanged("SalesOrderId"); + OnSalesOrderIdChanged(); + } + } + } + + /// Gets or sets the SpecialOfferId field. Mapped on target field 'SpecialOfferID'. + public System.Int32 SpecialOfferId + { + get { return _specialOfferId; } + set + { + if((_specialOfferId != value)) + { + if(_specialOfferProduct.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSpecialOfferIdChanging(value); + SendPropertyChanging("SpecialOfferId"); + _specialOfferId = value; + SendPropertyChanged("SpecialOfferId"); + OnSpecialOfferIdChanged(); + } + } + } + + /// Gets or sets the UnitPrice field. Mapped on target field 'UnitPrice'. + public System.Decimal UnitPrice + { + get { return _unitPrice; } + set + { + if((_unitPrice != value)) + { + OnUnitPriceChanging(value); + SendPropertyChanging("UnitPrice"); + _unitPrice = value; + SendPropertyChanged("UnitPrice"); + OnUnitPriceChanged(); + } + } + } + + /// Gets or sets the UnitPriceDiscount field. Mapped on target field 'UnitPriceDiscount'. + public System.Decimal UnitPriceDiscount + { + get { return _unitPriceDiscount; } + set + { + if((_unitPriceDiscount != value)) + { + OnUnitPriceDiscountChanging(value); + SendPropertyChanging("UnitPriceDiscount"); + _unitPriceDiscount = value; + SendPropertyChanged("UnitPriceDiscount"); + OnUnitPriceDiscountChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderDetail.SalesOrderHeader - SalesOrderHeader.SalesOrderDetails (m:1)' + public SalesOrderHeader SalesOrderHeader + { + get { return _salesOrderHeader.Entity; } + set + { + SalesOrderHeader previousValue = _salesOrderHeader.Entity; + if((previousValue != value) || (_salesOrderHeader.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesOrderHeader"); + if(previousValue != null) + { + _salesOrderHeader.Entity = null; + previousValue.SalesOrderDetails.Remove(this); + } + _salesOrderHeader.Entity = value; + if(value == null) + { + _salesOrderId = default(System.Int32); + } + else + { + value.SalesOrderDetails.Add(this); + _salesOrderId = value.SalesOrderId; + } + this.SendPropertyChanged("SalesOrderHeader"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderDetail.SpecialOfferProduct - SpecialOfferProduct.SalesOrderDetails (m:1)' + public SpecialOfferProduct SpecialOfferProduct + { + get { return _specialOfferProduct.Entity; } + set + { + SpecialOfferProduct previousValue = _specialOfferProduct.Entity; + if((previousValue != value) || (_specialOfferProduct.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SpecialOfferProduct"); + if(previousValue != null) + { + _specialOfferProduct.Entity = null; + previousValue.SalesOrderDetails.Remove(this); + } + _specialOfferProduct.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + _specialOfferId = default(System.Int32); + } + else + { + value.SalesOrderDetails.Add(this); + _productId = value.ProductId; + _specialOfferId = value.SpecialOfferId; + } + this.SendPropertyChanged("SpecialOfferProduct"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeader.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeader.cs new file mode 100644 index 0000000..2134af1 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeader.cs @@ -0,0 +1,898 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesOrderHeader', mapped on table 'AdventureWorks.Sales.SalesOrderHeader'. + public partial class SalesOrderHeader : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _accountNumber; + private System.Int32 _billToAddressId; + private System.String _comment; + private System.String _creditCardApprovalCode; + private Nullable _creditCardId; + private Nullable _currencyRateId; + private System.Int32 _customerId; + private System.DateTime _dueDate; + private System.Decimal _freight; + private System.DateTime _modifiedDate; + private System.Boolean _onlineOrderFlag; + private System.DateTime _orderDate; + private System.String _purchaseOrderNumber; + private System.Byte _revisionNumber; + private System.Guid _rowguid; + private System.Int32 _salesOrderId; + private System.String _salesOrderNumber; + private Nullable _salesPersonId; + private Nullable _shipDate; + private System.Int32 _shipMethodId; + private System.Int32 _shipToAddressId; + private System.Byte _status; + private System.Decimal _subTotal; + private System.Decimal _taxAmt; + private Nullable _territoryId; + private System.Decimal _totalDue; + private EntityRef
_address; + private EntityRef
_address1; + private EntityRef _creditCard; + private EntityRef _currencyRate; + private EntityRef _customer; + private EntitySet _salesOrderDetails; + private EntitySet _salesOrderHeaderSalesReasons; + private EntityRef _salesPerson; + private EntityRef _salesTerritory; + private EntityRef _shipMethod; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAccountNumberChanging(System.String value); + partial void OnAccountNumberChanged(); + partial void OnBillToAddressIdChanging(System.Int32 value); + partial void OnBillToAddressIdChanged(); + partial void OnCommentChanging(System.String value); + partial void OnCommentChanged(); + partial void OnCreditCardApprovalCodeChanging(System.String value); + partial void OnCreditCardApprovalCodeChanged(); + partial void OnCreditCardIdChanging(Nullable value); + partial void OnCreditCardIdChanged(); + partial void OnCurrencyRateIdChanging(Nullable value); + partial void OnCurrencyRateIdChanged(); + partial void OnCustomerIdChanging(System.Int32 value); + partial void OnCustomerIdChanged(); + partial void OnDueDateChanging(System.DateTime value); + partial void OnDueDateChanged(); + partial void OnFreightChanging(System.Decimal value); + partial void OnFreightChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOnlineOrderFlagChanging(System.Boolean value); + partial void OnOnlineOrderFlagChanged(); + partial void OnOrderDateChanging(System.DateTime value); + partial void OnOrderDateChanged(); + partial void OnPurchaseOrderNumberChanging(System.String value); + partial void OnPurchaseOrderNumberChanged(); + partial void OnRevisionNumberChanging(System.Byte value); + partial void OnRevisionNumberChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesOrderIdChanging(System.Int32 value); + partial void OnSalesOrderIdChanged(); + partial void OnSalesOrderNumberChanging(System.String value); + partial void OnSalesOrderNumberChanged(); + partial void OnSalesPersonIdChanging(Nullable value); + partial void OnSalesPersonIdChanged(); + partial void OnShipDateChanging(Nullable value); + partial void OnShipDateChanged(); + partial void OnShipMethodIdChanging(System.Int32 value); + partial void OnShipMethodIdChanged(); + partial void OnShipToAddressIdChanging(System.Int32 value); + partial void OnShipToAddressIdChanged(); + partial void OnStatusChanging(System.Byte value); + partial void OnStatusChanged(); + partial void OnSubTotalChanging(System.Decimal value); + partial void OnSubTotalChanged(); + partial void OnTaxAmtChanging(System.Decimal value); + partial void OnTaxAmtChanged(); + partial void OnTerritoryIdChanging(Nullable value); + partial void OnTerritoryIdChanged(); + partial void OnTotalDueChanging(System.Decimal value); + partial void OnTotalDueChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesOrderHeader() + { + _address = default(EntityRef
); + _address1 = default(EntityRef
); + _creditCard = default(EntityRef); + _currencyRate = default(EntityRef); + _customer = default(EntityRef); + _salesOrderDetails = new EntitySet(new Action(this.Attach_SalesOrderDetails), new Action(this.Detach_SalesOrderDetails) ); + _salesOrderHeaderSalesReasons = new EntitySet(new Action(this.Attach_SalesOrderHeaderSalesReasons), new Action(this.Detach_SalesOrderHeaderSalesReasons) ); + _salesPerson = default(EntityRef); + _salesTerritory = default(EntityRef); + _shipMethod = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderDetails(SalesOrderDetail entity) + { + this.SendPropertyChanging("SalesOrderDetails"); + entity.SalesOrderHeader = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderDetails(SalesOrderDetail entity) + { + this.SendPropertyChanging("SalesOrderDetails"); + entity.SalesOrderHeader = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaderSalesReasons(SalesOrderHeaderSalesReason entity) + { + this.SendPropertyChanging("SalesOrderHeaderSalesReasons"); + entity.SalesOrderHeader = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaderSalesReasons(SalesOrderHeaderSalesReason entity) + { + this.SendPropertyChanging("SalesOrderHeaderSalesReasons"); + entity.SalesOrderHeader = null; + } + + + #region Class Property Declarations + /// Gets or sets the AccountNumber field. Mapped on target field 'AccountNumber'. + public System.String AccountNumber + { + get { return _accountNumber; } + set + { + if((_accountNumber != value)) + { + OnAccountNumberChanging(value); + SendPropertyChanging("AccountNumber"); + _accountNumber = value; + SendPropertyChanged("AccountNumber"); + OnAccountNumberChanged(); + } + } + } + + /// Gets or sets the BillToAddressId field. Mapped on target field 'BillToAddressID'. + public System.Int32 BillToAddressId + { + get { return _billToAddressId; } + set + { + if((_billToAddressId != value)) + { + if(_address.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBillToAddressIdChanging(value); + SendPropertyChanging("BillToAddressId"); + _billToAddressId = value; + SendPropertyChanged("BillToAddressId"); + OnBillToAddressIdChanged(); + } + } + } + + /// Gets or sets the Comment field. Mapped on target field 'Comment'. + public System.String Comment + { + get { return _comment; } + set + { + if((_comment != value)) + { + OnCommentChanging(value); + SendPropertyChanging("Comment"); + _comment = value; + SendPropertyChanged("Comment"); + OnCommentChanged(); + } + } + } + + /// Gets or sets the CreditCardApprovalCode field. Mapped on target field 'CreditCardApprovalCode'. + public System.String CreditCardApprovalCode + { + get { return _creditCardApprovalCode; } + set + { + if((_creditCardApprovalCode != value)) + { + OnCreditCardApprovalCodeChanging(value); + SendPropertyChanging("CreditCardApprovalCode"); + _creditCardApprovalCode = value; + SendPropertyChanged("CreditCardApprovalCode"); + OnCreditCardApprovalCodeChanged(); + } + } + } + + /// Gets or sets the CreditCardId field. Mapped on target field 'CreditCardID'. + public Nullable CreditCardId + { + get { return _creditCardId; } + set + { + if((_creditCardId != value)) + { + if(_creditCard.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCreditCardIdChanging(value); + SendPropertyChanging("CreditCardId"); + _creditCardId = value; + SendPropertyChanged("CreditCardId"); + OnCreditCardIdChanged(); + } + } + } + + /// Gets or sets the CurrencyRateId field. Mapped on target field 'CurrencyRateID'. + public Nullable CurrencyRateId + { + get { return _currencyRateId; } + set + { + if((_currencyRateId != value)) + { + if(_currencyRate.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCurrencyRateIdChanging(value); + SendPropertyChanging("CurrencyRateId"); + _currencyRateId = value; + SendPropertyChanged("CurrencyRateId"); + OnCurrencyRateIdChanged(); + } + } + } + + /// Gets or sets the CustomerId field. Mapped on target field 'CustomerID'. + public System.Int32 CustomerId + { + get { return _customerId; } + set + { + if((_customerId != value)) + { + if(_customer.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCustomerIdChanging(value); + SendPropertyChanging("CustomerId"); + _customerId = value; + SendPropertyChanged("CustomerId"); + OnCustomerIdChanged(); + } + } + } + + /// Gets or sets the DueDate field. Mapped on target field 'DueDate'. + public System.DateTime DueDate + { + get { return _dueDate; } + set + { + if((_dueDate != value)) + { + OnDueDateChanging(value); + SendPropertyChanging("DueDate"); + _dueDate = value; + SendPropertyChanged("DueDate"); + OnDueDateChanged(); + } + } + } + + /// Gets or sets the Freight field. Mapped on target field 'Freight'. + public System.Decimal Freight + { + get { return _freight; } + set + { + if((_freight != value)) + { + OnFreightChanging(value); + SendPropertyChanging("Freight"); + _freight = value; + SendPropertyChanged("Freight"); + OnFreightChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OnlineOrderFlag field. Mapped on target field 'OnlineOrderFlag'. + public System.Boolean OnlineOrderFlag + { + get { return _onlineOrderFlag; } + set + { + if((_onlineOrderFlag != value)) + { + OnOnlineOrderFlagChanging(value); + SendPropertyChanging("OnlineOrderFlag"); + _onlineOrderFlag = value; + SendPropertyChanged("OnlineOrderFlag"); + OnOnlineOrderFlagChanged(); + } + } + } + + /// Gets or sets the OrderDate field. Mapped on target field 'OrderDate'. + public System.DateTime OrderDate + { + get { return _orderDate; } + set + { + if((_orderDate != value)) + { + OnOrderDateChanging(value); + SendPropertyChanging("OrderDate"); + _orderDate = value; + SendPropertyChanged("OrderDate"); + OnOrderDateChanged(); + } + } + } + + /// Gets or sets the PurchaseOrderNumber field. Mapped on target field 'PurchaseOrderNumber'. + public System.String PurchaseOrderNumber + { + get { return _purchaseOrderNumber; } + set + { + if((_purchaseOrderNumber != value)) + { + OnPurchaseOrderNumberChanging(value); + SendPropertyChanging("PurchaseOrderNumber"); + _purchaseOrderNumber = value; + SendPropertyChanged("PurchaseOrderNumber"); + OnPurchaseOrderNumberChanged(); + } + } + } + + /// Gets or sets the RevisionNumber field. Mapped on target field 'RevisionNumber'. + public System.Byte RevisionNumber + { + get { return _revisionNumber; } + set + { + if((_revisionNumber != value)) + { + OnRevisionNumberChanging(value); + SendPropertyChanging("RevisionNumber"); + _revisionNumber = value; + SendPropertyChanged("RevisionNumber"); + OnRevisionNumberChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesOrderId field. Mapped on target field 'SalesOrderID'. + public System.Int32 SalesOrderId + { + get { return _salesOrderId; } + set + { + if((_salesOrderId != value)) + { + OnSalesOrderIdChanging(value); + SendPropertyChanging("SalesOrderId"); + _salesOrderId = value; + SendPropertyChanged("SalesOrderId"); + OnSalesOrderIdChanged(); + } + } + } + + /// Gets or sets the SalesOrderNumber field. Mapped on target field 'SalesOrderNumber'. + public System.String SalesOrderNumber + { + get { return _salesOrderNumber; } + } + + /// Gets or sets the SalesPersonId field. Mapped on target field 'SalesPersonID'. + public Nullable SalesPersonId + { + get { return _salesPersonId; } + set + { + if((_salesPersonId != value)) + { + if(_salesPerson.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSalesPersonIdChanging(value); + SendPropertyChanging("SalesPersonId"); + _salesPersonId = value; + SendPropertyChanged("SalesPersonId"); + OnSalesPersonIdChanged(); + } + } + } + + /// Gets or sets the ShipDate field. Mapped on target field 'ShipDate'. + public Nullable ShipDate + { + get { return _shipDate; } + set + { + if((_shipDate != value)) + { + OnShipDateChanging(value); + SendPropertyChanging("ShipDate"); + _shipDate = value; + SendPropertyChanged("ShipDate"); + OnShipDateChanged(); + } + } + } + + /// Gets or sets the ShipMethodId field. Mapped on target field 'ShipMethodID'. + public System.Int32 ShipMethodId + { + get { return _shipMethodId; } + set + { + if((_shipMethodId != value)) + { + if(_shipMethod.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnShipMethodIdChanging(value); + SendPropertyChanging("ShipMethodId"); + _shipMethodId = value; + SendPropertyChanged("ShipMethodId"); + OnShipMethodIdChanged(); + } + } + } + + /// Gets or sets the ShipToAddressId field. Mapped on target field 'ShipToAddressID'. + public System.Int32 ShipToAddressId + { + get { return _shipToAddressId; } + set + { + if((_shipToAddressId != value)) + { + if(_address1.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnShipToAddressIdChanging(value); + SendPropertyChanging("ShipToAddressId"); + _shipToAddressId = value; + SendPropertyChanged("ShipToAddressId"); + OnShipToAddressIdChanged(); + } + } + } + + /// Gets or sets the Status field. Mapped on target field 'Status'. + public System.Byte Status + { + get { return _status; } + set + { + if((_status != value)) + { + OnStatusChanging(value); + SendPropertyChanging("Status"); + _status = value; + SendPropertyChanged("Status"); + OnStatusChanged(); + } + } + } + + /// Gets or sets the SubTotal field. Mapped on target field 'SubTotal'. + public System.Decimal SubTotal + { + get { return _subTotal; } + set + { + if((_subTotal != value)) + { + OnSubTotalChanging(value); + SendPropertyChanging("SubTotal"); + _subTotal = value; + SendPropertyChanged("SubTotal"); + OnSubTotalChanged(); + } + } + } + + /// Gets or sets the TaxAmt field. Mapped on target field 'TaxAmt'. + public System.Decimal TaxAmt + { + get { return _taxAmt; } + set + { + if((_taxAmt != value)) + { + OnTaxAmtChanging(value); + SendPropertyChanging("TaxAmt"); + _taxAmt = value; + SendPropertyChanged("TaxAmt"); + OnTaxAmtChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public Nullable TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + if(_salesTerritory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Gets or sets the TotalDue field. Mapped on target field 'TotalDue'. + public System.Decimal TotalDue + { + get { return _totalDue; } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address - Address.SalesOrderHeaders (m:1)' + public Address Address + { + get { return _address.Entity; } + set + { + Address previousValue = _address.Entity; + if((previousValue != value) || (_address.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Address"); + if(previousValue != null) + { + _address.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _address.Entity = value; + if(value == null) + { + _billToAddressId = default(System.Int32); + } + else + { + value.SalesOrderHeaders.Add(this); + _billToAddressId = value.Id; + } + this.SendPropertyChanged("Address"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address1 - Address.SalesOrderHeaders1 (m:1)' + public Address Address1 + { + get { return _address1.Entity; } + set + { + Address previousValue = _address1.Entity; + if((previousValue != value) || (_address1.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Address1"); + if(previousValue != null) + { + _address1.Entity = null; + previousValue.SalesOrderHeaders1.Remove(this); + } + _address1.Entity = value; + if(value == null) + { + _shipToAddressId = default(System.Int32); + } + else + { + value.SalesOrderHeaders1.Add(this); + _shipToAddressId = value.Id; + } + this.SendPropertyChanged("Address1"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.CreditCard - CreditCard.SalesOrderHeaders (m:1)' + public CreditCard CreditCard + { + get { return _creditCard.Entity; } + set + { + CreditCard previousValue = _creditCard.Entity; + if((previousValue != value) || (_creditCard.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CreditCard"); + if(previousValue != null) + { + _creditCard.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _creditCard.Entity = value; + if(value == null) + { + _creditCardId = default(Nullable); + } + else + { + value.SalesOrderHeaders.Add(this); + _creditCardId = value.CreditCardId; + } + this.SendPropertyChanged("CreditCard"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.CurrencyRate - CurrencyRate.SalesOrderHeaders (m:1)' + public CurrencyRate CurrencyRate + { + get { return _currencyRate.Entity; } + set + { + CurrencyRate previousValue = _currencyRate.Entity; + if((previousValue != value) || (_currencyRate.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CurrencyRate"); + if(previousValue != null) + { + _currencyRate.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _currencyRate.Entity = value; + if(value == null) + { + _currencyRateId = default(Nullable); + } + else + { + value.SalesOrderHeaders.Add(this); + _currencyRateId = value.CurrencyRateId; + } + this.SendPropertyChanged("CurrencyRate"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.Customer - Customer.SalesOrderHeaders (m:1)' + public Customer Customer + { + get { return _customer.Entity; } + set + { + Customer previousValue = _customer.Entity; + if((previousValue != value) || (_customer.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Customer"); + if(previousValue != null) + { + _customer.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _customer.Entity = value; + if(value == null) + { + _customerId = default(System.Int32); + } + else + { + value.SalesOrderHeaders.Add(this); + _customerId = value.CustomerId; + } + this.SendPropertyChanged("Customer"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderDetail.SalesOrderHeader - SalesOrderHeader.SalesOrderDetails (m:1)' + public EntitySet SalesOrderDetails + { + get { return this._salesOrderDetails; } + set { this._salesOrderDetails.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeaderSalesReason.SalesOrderHeader - SalesOrderHeader.SalesOrderHeaderSalesReasons (m:1)' + public EntitySet SalesOrderHeaderSalesReasons + { + get { return this._salesOrderHeaderSalesReasons; } + set { this._salesOrderHeaderSalesReasons.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.SalesPerson - SalesPerson.SalesOrderHeaders (m:1)' + public SalesPerson SalesPerson + { + get { return _salesPerson.Entity; } + set + { + SalesPerson previousValue = _salesPerson.Entity; + if((previousValue != value) || (_salesPerson.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesPerson"); + if(previousValue != null) + { + _salesPerson.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _salesPerson.Entity = value; + if(value == null) + { + _salesPersonId = default(Nullable); + } + else + { + value.SalesOrderHeaders.Add(this); + _salesPersonId = value.BusinessEntityId; + } + this.SendPropertyChanged("SalesPerson"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.SalesTerritory - SalesTerritory.SalesOrderHeaders (m:1)' + public SalesTerritory SalesTerritory + { + get { return _salesTerritory.Entity; } + set + { + SalesTerritory previousValue = _salesTerritory.Entity; + if((previousValue != value) || (_salesTerritory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesTerritory"); + if(previousValue != null) + { + _salesTerritory.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _salesTerritory.Entity = value; + if(value == null) + { + _territoryId = default(Nullable); + } + else + { + value.SalesOrderHeaders.Add(this); + _territoryId = value.TerritoryId; + } + this.SendPropertyChanged("SalesTerritory"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.ShipMethod - ShipMethod.SalesOrderHeaders (m:1)' + public ShipMethod ShipMethod + { + get { return _shipMethod.Entity; } + set + { + ShipMethod previousValue = _shipMethod.Entity; + if((previousValue != value) || (_shipMethod.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ShipMethod"); + if(previousValue != null) + { + _shipMethod.Entity = null; + previousValue.SalesOrderHeaders.Remove(this); + } + _shipMethod.Entity = value; + if(value == null) + { + _shipMethodId = default(System.Int32); + } + else + { + value.SalesOrderHeaders.Add(this); + _shipMethodId = value.ShipMethodId; + } + this.SendPropertyChanged("ShipMethod"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeaderSalesReason.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeaderSalesReason.cs new file mode 100644 index 0000000..6362799 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesOrderHeaderSalesReason.cs @@ -0,0 +1,194 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesOrderHeaderSalesReason', mapped on table 'AdventureWorks.Sales.SalesOrderHeaderSalesReason'. + public partial class SalesOrderHeaderSalesReason : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.Int32 _salesOrderId; + private System.Int32 _salesReasonId; + private EntityRef _salesOrderHeader; + private EntityRef _salesReason; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnSalesOrderIdChanging(System.Int32 value); + partial void OnSalesOrderIdChanged(); + partial void OnSalesReasonIdChanging(System.Int32 value); + partial void OnSalesReasonIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesOrderHeaderSalesReason() + { + _salesOrderHeader = default(EntityRef); + _salesReason = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the SalesOrderId field. Mapped on target field 'SalesOrderID'. + public System.Int32 SalesOrderId + { + get { return _salesOrderId; } + set + { + if((_salesOrderId != value)) + { + if(_salesOrderHeader.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSalesOrderIdChanging(value); + SendPropertyChanging("SalesOrderId"); + _salesOrderId = value; + SendPropertyChanged("SalesOrderId"); + OnSalesOrderIdChanged(); + } + } + } + + /// Gets or sets the SalesReasonId field. Mapped on target field 'SalesReasonID'. + public System.Int32 SalesReasonId + { + get { return _salesReasonId; } + set + { + if((_salesReasonId != value)) + { + if(_salesReason.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSalesReasonIdChanging(value); + SendPropertyChanging("SalesReasonId"); + _salesReasonId = value; + SendPropertyChanged("SalesReasonId"); + OnSalesReasonIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeaderSalesReason.SalesOrderHeader - SalesOrderHeader.SalesOrderHeaderSalesReasons (m:1)' + public SalesOrderHeader SalesOrderHeader + { + get { return _salesOrderHeader.Entity; } + set + { + SalesOrderHeader previousValue = _salesOrderHeader.Entity; + if((previousValue != value) || (_salesOrderHeader.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesOrderHeader"); + if(previousValue != null) + { + _salesOrderHeader.Entity = null; + previousValue.SalesOrderHeaderSalesReasons.Remove(this); + } + _salesOrderHeader.Entity = value; + if(value == null) + { + _salesOrderId = default(System.Int32); + } + else + { + value.SalesOrderHeaderSalesReasons.Add(this); + _salesOrderId = value.SalesOrderId; + } + this.SendPropertyChanged("SalesOrderHeader"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeaderSalesReason.SalesReason - SalesReason.SalesOrderHeaderSalesReasons (m:1)' + public SalesReason SalesReason + { + get { return _salesReason.Entity; } + set + { + SalesReason previousValue = _salesReason.Entity; + if((previousValue != value) || (_salesReason.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesReason"); + if(previousValue != null) + { + _salesReason.Entity = null; + previousValue.SalesOrderHeaderSalesReasons.Remove(this); + } + _salesReason.Entity = value; + if(value == null) + { + _salesReasonId = default(System.Int32); + } + else + { + value.SalesOrderHeaderSalesReasons.Add(this); + _salesReasonId = value.SalesReasonId; + } + this.SendPropertyChanged("SalesReason"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesPerson.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesPerson.cs new file mode 100644 index 0000000..7698044 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesPerson.cs @@ -0,0 +1,414 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesPerson', mapped on table 'AdventureWorks.Sales.SalesPerson'. + public partial class SalesPerson : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _bonus; + private System.Int32 _businessEntityId; + private System.Decimal _commissionPct; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private System.Decimal _salesLastYear; + private Nullable _salesQuota; + private System.Decimal _salesYtd; + private Nullable _territoryId; + private EntityRef _employee; + private EntitySet _salesOrderHeaders; + private EntitySet _salesPersonQuotaHistories; + private EntityRef _salesTerritory; + private EntitySet _salesTerritoryHistories; + private EntitySet _stores; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBonusChanging(System.Decimal value); + partial void OnBonusChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnCommissionPctChanging(System.Decimal value); + partial void OnCommissionPctChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesLastYearChanging(System.Decimal value); + partial void OnSalesLastYearChanged(); + partial void OnSalesQuotaChanging(Nullable value); + partial void OnSalesQuotaChanged(); + partial void OnSalesYtdChanging(System.Decimal value); + partial void OnSalesYtdChanged(); + partial void OnTerritoryIdChanging(Nullable value); + partial void OnTerritoryIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesPerson() + { + _employee = default(EntityRef); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + _salesPersonQuotaHistories = new EntitySet(new Action(this.Attach_SalesPersonQuotaHistories), new Action(this.Detach_SalesPersonQuotaHistories) ); + _salesTerritory = default(EntityRef); + _salesTerritoryHistories = new EntitySet(new Action(this.Attach_SalesTerritoryHistories), new Action(this.Detach_SalesTerritoryHistories) ); + _stores = new EntitySet(new Action(this.Attach_Stores), new Action(this.Detach_Stores) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.SalesPerson = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.SalesPerson = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesPersonQuotaHistories(SalesPersonQuotaHistory entity) + { + this.SendPropertyChanging("SalesPersonQuotaHistories"); + entity.SalesPerson = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesPersonQuotaHistories(SalesPersonQuotaHistory entity) + { + this.SendPropertyChanging("SalesPersonQuotaHistories"); + entity.SalesPerson = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesTerritoryHistories(SalesTerritoryHistory entity) + { + this.SendPropertyChanging("SalesTerritoryHistories"); + entity.SalesPerson = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesTerritoryHistories(SalesTerritoryHistory entity) + { + this.SendPropertyChanging("SalesTerritoryHistories"); + entity.SalesPerson = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Stores(Store entity) + { + this.SendPropertyChanging("Stores"); + entity.SalesPerson = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Stores(Store entity) + { + this.SendPropertyChanging("Stores"); + entity.SalesPerson = null; + } + + + #region Class Property Declarations + /// Gets or sets the Bonus field. Mapped on target field 'Bonus'. + public System.Decimal Bonus + { + get { return _bonus; } + set + { + if((_bonus != value)) + { + OnBonusChanging(value); + SendPropertyChanging("Bonus"); + _bonus = value; + SendPropertyChanged("Bonus"); + OnBonusChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_employee.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the CommissionPct field. Mapped on target field 'CommissionPct'. + public System.Decimal CommissionPct + { + get { return _commissionPct; } + set + { + if((_commissionPct != value)) + { + OnCommissionPctChanging(value); + SendPropertyChanging("CommissionPct"); + _commissionPct = value; + SendPropertyChanged("CommissionPct"); + OnCommissionPctChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesLastYear field. Mapped on target field 'SalesLastYear'. + public System.Decimal SalesLastYear + { + get { return _salesLastYear; } + set + { + if((_salesLastYear != value)) + { + OnSalesLastYearChanging(value); + SendPropertyChanging("SalesLastYear"); + _salesLastYear = value; + SendPropertyChanged("SalesLastYear"); + OnSalesLastYearChanged(); + } + } + } + + /// Gets or sets the SalesQuota field. Mapped on target field 'SalesQuota'. + public Nullable SalesQuota + { + get { return _salesQuota; } + set + { + if((_salesQuota != value)) + { + OnSalesQuotaChanging(value); + SendPropertyChanging("SalesQuota"); + _salesQuota = value; + SendPropertyChanged("SalesQuota"); + OnSalesQuotaChanged(); + } + } + } + + /// Gets or sets the SalesYtd field. Mapped on target field 'SalesYTD'. + public System.Decimal SalesYtd + { + get { return _salesYtd; } + set + { + if((_salesYtd != value)) + { + OnSalesYtdChanging(value); + SendPropertyChanging("SalesYtd"); + _salesYtd = value; + SendPropertyChanged("SalesYtd"); + OnSalesYtdChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public Nullable TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + if(_salesTerritory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesPerson.Employee - Employee.SalesPerson (1:1)' + public Employee Employee + { + get { return _employee.Entity; } + set + { + Employee previousValue = _employee.Entity; + if((previousValue != value) || (_employee.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Employee"); + if(previousValue != null) + { + _employee.Entity = null; + previousValue.SalesPerson=null; + } + _employee.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.SalesPerson = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("Employee"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.SalesPerson - SalesPerson.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesPersonQuotaHistory.SalesPerson - SalesPerson.SalesPersonQuotaHistories (m:1)' + public EntitySet SalesPersonQuotaHistories + { + get { return this._salesPersonQuotaHistories; } + set { this._salesPersonQuotaHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesPerson.SalesTerritory - SalesTerritory.SalesPeople (m:1)' + public SalesTerritory SalesTerritory + { + get { return _salesTerritory.Entity; } + set + { + SalesTerritory previousValue = _salesTerritory.Entity; + if((previousValue != value) || (_salesTerritory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesTerritory"); + if(previousValue != null) + { + _salesTerritory.Entity = null; + previousValue.SalesPeople.Remove(this); + } + _salesTerritory.Entity = value; + if(value == null) + { + _territoryId = default(Nullable); + } + else + { + value.SalesPeople.Add(this); + _territoryId = value.TerritoryId; + } + this.SendPropertyChanged("SalesTerritory"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritoryHistory.SalesPerson - SalesPerson.SalesTerritoryHistories (m:1)' + public EntitySet SalesTerritoryHistories + { + get { return this._salesTerritoryHistories; } + set { this._salesTerritoryHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Store.SalesPerson - SalesPerson.Stores (m:1)' + public EntitySet Stores + { + get { return this._stores; } + set { this._stores.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesPersonQuotaHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesPersonQuotaHistory.cs new file mode 100644 index 0000000..9d240d4 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesPersonQuotaHistory.cs @@ -0,0 +1,198 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesPersonQuotaHistory', mapped on table 'AdventureWorks.Sales.SalesPersonQuotaHistory'. + public partial class SalesPersonQuotaHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.DateTime _modifiedDate; + private System.DateTime _quotaDate; + private System.Guid _rowguid; + private System.Decimal _salesQuota; + private EntityRef _salesPerson; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnQuotaDateChanging(System.DateTime value); + partial void OnQuotaDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesQuotaChanging(System.Decimal value); + partial void OnSalesQuotaChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesPersonQuotaHistory() + { + _salesPerson = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_salesPerson.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the QuotaDate field. Mapped on target field 'QuotaDate'. + public System.DateTime QuotaDate + { + get { return _quotaDate; } + set + { + if((_quotaDate != value)) + { + OnQuotaDateChanging(value); + SendPropertyChanging("QuotaDate"); + _quotaDate = value; + SendPropertyChanged("QuotaDate"); + OnQuotaDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesQuota field. Mapped on target field 'SalesQuota'. + public System.Decimal SalesQuota + { + get { return _salesQuota; } + set + { + if((_salesQuota != value)) + { + OnSalesQuotaChanging(value); + SendPropertyChanging("SalesQuota"); + _salesQuota = value; + SendPropertyChanged("SalesQuota"); + OnSalesQuotaChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesPersonQuotaHistory.SalesPerson - SalesPerson.SalesPersonQuotaHistories (m:1)' + public SalesPerson SalesPerson + { + get { return _salesPerson.Entity; } + set + { + SalesPerson previousValue = _salesPerson.Entity; + if((previousValue != value) || (_salesPerson.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesPerson"); + if(previousValue != null) + { + _salesPerson.Entity = null; + previousValue.SalesPersonQuotaHistories.Remove(this); + } + _salesPerson.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.SalesPersonQuotaHistories.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("SalesPerson"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesReason.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesReason.cs new file mode 100644 index 0000000..287630b --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesReason.cs @@ -0,0 +1,167 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesReason', mapped on table 'AdventureWorks.Sales.SalesReason'. + public partial class SalesReason : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.String _reasonType; + private System.Int32 _salesReasonId; + private EntitySet _salesOrderHeaderSalesReasons; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnReasonTypeChanging(System.String value); + partial void OnReasonTypeChanged(); + partial void OnSalesReasonIdChanging(System.Int32 value); + partial void OnSalesReasonIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesReason() + { + _salesOrderHeaderSalesReasons = new EntitySet(new Action(this.Attach_SalesOrderHeaderSalesReasons), new Action(this.Detach_SalesOrderHeaderSalesReasons) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaderSalesReasons(SalesOrderHeaderSalesReason entity) + { + this.SendPropertyChanging("SalesOrderHeaderSalesReasons"); + entity.SalesReason = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaderSalesReasons(SalesOrderHeaderSalesReason entity) + { + this.SendPropertyChanging("SalesOrderHeaderSalesReasons"); + entity.SalesReason = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ReasonType field. Mapped on target field 'ReasonType'. + public System.String ReasonType + { + get { return _reasonType; } + set + { + if((_reasonType != value)) + { + OnReasonTypeChanging(value); + SendPropertyChanging("ReasonType"); + _reasonType = value; + SendPropertyChanged("ReasonType"); + OnReasonTypeChanged(); + } + } + } + + /// Gets or sets the SalesReasonId field. Mapped on target field 'SalesReasonID'. + public System.Int32 SalesReasonId + { + get { return _salesReasonId; } + set + { + if((_salesReasonId != value)) + { + OnSalesReasonIdChanging(value); + SendPropertyChanging("SalesReasonId"); + _salesReasonId = value; + SendPropertyChanged("SalesReasonId"); + OnSalesReasonIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeaderSalesReason.SalesReason - SalesReason.SalesOrderHeaderSalesReasons (m:1)' + public EntitySet SalesOrderHeaderSalesReasons + { + get { return this._salesOrderHeaderSalesReasons; } + set { this._salesOrderHeaderSalesReasons.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesTaxRate.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesTaxRate.cs new file mode 100644 index 0000000..5341e2a --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesTaxRate.cs @@ -0,0 +1,238 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesTaxRate', mapped on table 'AdventureWorks.Sales.SalesTaxRate'. + public partial class SalesTaxRate : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private System.Int32 _salesTaxRateId; + private System.Int32 _stateProvinceId; + private System.Decimal _taxRate; + private System.Byte _taxType; + private EntityRef _stateProvince; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesTaxRateIdChanging(System.Int32 value); + partial void OnSalesTaxRateIdChanged(); + partial void OnStateProvinceIdChanging(System.Int32 value); + partial void OnStateProvinceIdChanged(); + partial void OnTaxRateChanging(System.Decimal value); + partial void OnTaxRateChanged(); + partial void OnTaxTypeChanging(System.Byte value); + partial void OnTaxTypeChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesTaxRate() + { + _stateProvince = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesTaxRateId field. Mapped on target field 'SalesTaxRateID'. + public System.Int32 SalesTaxRateId + { + get { return _salesTaxRateId; } + set + { + if((_salesTaxRateId != value)) + { + OnSalesTaxRateIdChanging(value); + SendPropertyChanging("SalesTaxRateId"); + _salesTaxRateId = value; + SendPropertyChanged("SalesTaxRateId"); + OnSalesTaxRateIdChanged(); + } + } + } + + /// Gets or sets the StateProvinceId field. Mapped on target field 'StateProvinceID'. + public System.Int32 StateProvinceId + { + get { return _stateProvinceId; } + set + { + if((_stateProvinceId != value)) + { + if(_stateProvince.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnStateProvinceIdChanging(value); + SendPropertyChanging("StateProvinceId"); + _stateProvinceId = value; + SendPropertyChanged("StateProvinceId"); + OnStateProvinceIdChanged(); + } + } + } + + /// Gets or sets the TaxRate field. Mapped on target field 'TaxRate'. + public System.Decimal TaxRate + { + get { return _taxRate; } + set + { + if((_taxRate != value)) + { + OnTaxRateChanging(value); + SendPropertyChanging("TaxRate"); + _taxRate = value; + SendPropertyChanged("TaxRate"); + OnTaxRateChanged(); + } + } + } + + /// Gets or sets the TaxType field. Mapped on target field 'TaxType'. + public System.Byte TaxType + { + get { return _taxType; } + set + { + if((_taxType != value)) + { + OnTaxTypeChanging(value); + SendPropertyChanging("TaxType"); + _taxType = value; + SendPropertyChanged("TaxType"); + OnTaxTypeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTaxRate.StateProvince - StateProvince.SalesTaxRates (m:1)' + public StateProvince StateProvince + { + get { return _stateProvince.Entity; } + set + { + StateProvince previousValue = _stateProvince.Entity; + if((previousValue != value) || (_stateProvince.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("StateProvince"); + if(previousValue != null) + { + _stateProvince.Entity = null; + previousValue.SalesTaxRates.Remove(this); + } + _stateProvince.Entity = value; + if(value == null) + { + _stateProvinceId = default(System.Int32); + } + else + { + value.SalesTaxRates.Add(this); + _stateProvinceId = value.StateProvinceId; + } + this.SendPropertyChanged("StateProvince"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesTerritory.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesTerritory.cs new file mode 100644 index 0000000..823257e --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesTerritory.cs @@ -0,0 +1,423 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesTerritory', mapped on table 'AdventureWorks.Sales.SalesTerritory'. + public partial class SalesTerritory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _costLastYear; + private System.Decimal _costYtd; + private System.String _countryRegionCode; + private System.String _group; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private System.Decimal _salesLastYear; + private System.Decimal _salesYtd; + private System.Int32 _territoryId; + private EntityRef _countryRegion; + private EntitySet _customers; + private EntitySet _salesOrderHeaders; + private EntitySet _salesPeople; + private EntitySet _salesTerritoryHistories; + private EntitySet _stateProvinces; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCostLastYearChanging(System.Decimal value); + partial void OnCostLastYearChanged(); + partial void OnCostYtdChanging(System.Decimal value); + partial void OnCostYtdChanged(); + partial void OnCountryRegionCodeChanging(System.String value); + partial void OnCountryRegionCodeChanged(); + partial void OnGroupChanging(System.String value); + partial void OnGroupChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesLastYearChanging(System.Decimal value); + partial void OnSalesLastYearChanged(); + partial void OnSalesYtdChanging(System.Decimal value); + partial void OnSalesYtdChanged(); + partial void OnTerritoryIdChanging(System.Int32 value); + partial void OnTerritoryIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesTerritory() + { + _countryRegion = default(EntityRef); + _customers = new EntitySet(new Action(this.Attach_Customers), new Action(this.Detach_Customers) ); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + _salesPeople = new EntitySet(new Action(this.Attach_SalesPeople), new Action(this.Detach_SalesPeople) ); + _salesTerritoryHistories = new EntitySet(new Action(this.Attach_SalesTerritoryHistories), new Action(this.Detach_SalesTerritoryHistories) ); + _stateProvinces = new EntitySet(new Action(this.Attach_StateProvinces), new Action(this.Detach_StateProvinces) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.SalesTerritory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.SalesTerritory = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.SalesTerritory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.SalesTerritory = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesPeople(SalesPerson entity) + { + this.SendPropertyChanging("SalesPeople"); + entity.SalesTerritory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesPeople(SalesPerson entity) + { + this.SendPropertyChanging("SalesPeople"); + entity.SalesTerritory = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesTerritoryHistories(SalesTerritoryHistory entity) + { + this.SendPropertyChanging("SalesTerritoryHistories"); + entity.SalesTerritory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesTerritoryHistories(SalesTerritoryHistory entity) + { + this.SendPropertyChanging("SalesTerritoryHistories"); + entity.SalesTerritory = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_StateProvinces(StateProvince entity) + { + this.SendPropertyChanging("StateProvinces"); + entity.SalesTerritory = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_StateProvinces(StateProvince entity) + { + this.SendPropertyChanging("StateProvinces"); + entity.SalesTerritory = null; + } + + + #region Class Property Declarations + /// Gets or sets the CostLastYear field. Mapped on target field 'CostLastYear'. + public System.Decimal CostLastYear + { + get { return _costLastYear; } + set + { + if((_costLastYear != value)) + { + OnCostLastYearChanging(value); + SendPropertyChanging("CostLastYear"); + _costLastYear = value; + SendPropertyChanged("CostLastYear"); + OnCostLastYearChanged(); + } + } + } + + /// Gets or sets the CostYtd field. Mapped on target field 'CostYTD'. + public System.Decimal CostYtd + { + get { return _costYtd; } + set + { + if((_costYtd != value)) + { + OnCostYtdChanging(value); + SendPropertyChanging("CostYtd"); + _costYtd = value; + SendPropertyChanged("CostYtd"); + OnCostYtdChanged(); + } + } + } + + /// Gets or sets the CountryRegionCode field. Mapped on target field 'CountryRegionCode'. + public System.String CountryRegionCode + { + get { return _countryRegionCode; } + set + { + if((_countryRegionCode != value)) + { + if(_countryRegion.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCountryRegionCodeChanging(value); + SendPropertyChanging("CountryRegionCode"); + _countryRegionCode = value; + SendPropertyChanged("CountryRegionCode"); + OnCountryRegionCodeChanged(); + } + } + } + + /// Gets or sets the Group field. Mapped on target field 'Group'. + public System.String Group + { + get { return _group; } + set + { + if((_group != value)) + { + OnGroupChanging(value); + SendPropertyChanging("Group"); + _group = value; + SendPropertyChanged("Group"); + OnGroupChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesLastYear field. Mapped on target field 'SalesLastYear'. + public System.Decimal SalesLastYear + { + get { return _salesLastYear; } + set + { + if((_salesLastYear != value)) + { + OnSalesLastYearChanging(value); + SendPropertyChanging("SalesLastYear"); + _salesLastYear = value; + SendPropertyChanged("SalesLastYear"); + OnSalesLastYearChanged(); + } + } + } + + /// Gets or sets the SalesYtd field. Mapped on target field 'SalesYTD'. + public System.Decimal SalesYtd + { + get { return _salesYtd; } + set + { + if((_salesYtd != value)) + { + OnSalesYtdChanging(value); + SendPropertyChanging("SalesYtd"); + _salesYtd = value; + SendPropertyChanged("SalesYtd"); + OnSalesYtdChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public System.Int32 TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritory.CountryRegion - CountryRegion.SalesTerritories (m:1)' + public CountryRegion CountryRegion + { + get { return _countryRegion.Entity; } + set + { + CountryRegion previousValue = _countryRegion.Entity; + if((previousValue != value) || (_countryRegion.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CountryRegion"); + if(previousValue != null) + { + _countryRegion.Entity = null; + previousValue.SalesTerritories.Remove(this); + } + _countryRegion.Entity = value; + if(value == null) + { + _countryRegionCode = default(System.String); + } + else + { + value.SalesTerritories.Add(this); + _countryRegionCode = value.CountryRegionCode; + } + this.SendPropertyChanged("CountryRegion"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Customer.SalesTerritory - SalesTerritory.Customers (m:1)' + public EntitySet Customers + { + get { return this._customers; } + set { this._customers.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.SalesTerritory - SalesTerritory.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesPerson.SalesTerritory - SalesTerritory.SalesPeople (m:1)' + public EntitySet SalesPeople + { + get { return this._salesPeople; } + set { this._salesPeople.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritoryHistory.SalesTerritory - SalesTerritory.SalesTerritoryHistories (m:1)' + public EntitySet SalesTerritoryHistories + { + get { return this._salesTerritoryHistories; } + set { this._salesTerritoryHistories.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'StateProvince.SalesTerritory - SalesTerritory.StateProvinces (m:1)' + public EntitySet StateProvinces + { + get { return this._stateProvinces; } + set { this._stateProvinces.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SalesTerritoryHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/SalesTerritoryHistory.cs new file mode 100644 index 0000000..940c617 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SalesTerritoryHistory.cs @@ -0,0 +1,254 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SalesTerritoryHistory', mapped on table 'AdventureWorks.Sales.SalesTerritoryHistory'. + public partial class SalesTerritoryHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private Nullable _endDate; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private System.DateTime _startDate; + private System.Int32 _territoryId; + private EntityRef _salesPerson; + private EntityRef _salesTerritory; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + partial void OnTerritoryIdChanging(System.Int32 value); + partial void OnTerritoryIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SalesTerritoryHistory() + { + _salesPerson = default(EntityRef); + _salesTerritory = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_salesPerson.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public System.Int32 TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + if(_salesTerritory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritoryHistory.SalesPerson - SalesPerson.SalesTerritoryHistories (m:1)' + public SalesPerson SalesPerson + { + get { return _salesPerson.Entity; } + set + { + SalesPerson previousValue = _salesPerson.Entity; + if((previousValue != value) || (_salesPerson.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesPerson"); + if(previousValue != null) + { + _salesPerson.Entity = null; + previousValue.SalesTerritoryHistories.Remove(this); + } + _salesPerson.Entity = value; + if(value == null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.SalesTerritoryHistories.Add(this); + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("SalesPerson"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTerritoryHistory.SalesTerritory - SalesTerritory.SalesTerritoryHistories (m:1)' + public SalesTerritory SalesTerritory + { + get { return _salesTerritory.Entity; } + set + { + SalesTerritory previousValue = _salesTerritory.Entity; + if((previousValue != value) || (_salesTerritory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesTerritory"); + if(previousValue != null) + { + _salesTerritory.Entity = null; + previousValue.SalesTerritoryHistories.Remove(this); + } + _salesTerritory.Entity = value; + if(value == null) + { + _territoryId = default(System.Int32); + } + else + { + value.SalesTerritoryHistories.Add(this); + _territoryId = value.TerritoryId; + } + this.SendPropertyChanged("SalesTerritory"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ScrapReason.cs b/tests/AdventureWorks2008Model/EntityClasses/ScrapReason.cs new file mode 100644 index 0000000..c697291 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ScrapReason.cs @@ -0,0 +1,147 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ScrapReason', mapped on table 'AdventureWorks.Production.ScrapReason'. + public partial class ScrapReason : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Int16 _scrapReasonId; + private EntitySet _workOrders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnScrapReasonIdChanging(System.Int16 value); + partial void OnScrapReasonIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ScrapReason() + { + _workOrders = new EntitySet(new Action(this.Attach_WorkOrders), new Action(this.Detach_WorkOrders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_WorkOrders(WorkOrder entity) + { + this.SendPropertyChanging("WorkOrders"); + entity.ScrapReason = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_WorkOrders(WorkOrder entity) + { + this.SendPropertyChanging("WorkOrders"); + entity.ScrapReason = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ScrapReasonId field. Mapped on target field 'ScrapReasonID'. + public System.Int16 ScrapReasonId + { + get { return _scrapReasonId; } + set + { + if((_scrapReasonId != value)) + { + OnScrapReasonIdChanging(value); + SendPropertyChanging("ScrapReasonId"); + _scrapReasonId = value; + SendPropertyChanged("ScrapReasonId"); + OnScrapReasonIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrder.ScrapReason - ScrapReason.WorkOrders (m:1)' + public EntitySet WorkOrders + { + get { return this._workOrders; } + set { this._workOrders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Shift.cs b/tests/AdventureWorks2008Model/EntityClasses/Shift.cs new file mode 100644 index 0000000..7855176 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Shift.cs @@ -0,0 +1,187 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Shift', mapped on table 'AdventureWorks.HumanResources.Shift'. + public partial class Shift : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.TimeSpan _endTime; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Byte _shiftId; + private System.TimeSpan _startTime; + private EntitySet _employeeDepartmentHistories; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEndTimeChanging(System.TimeSpan value); + partial void OnEndTimeChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnShiftIdChanging(System.Byte value); + partial void OnShiftIdChanged(); + partial void OnStartTimeChanging(System.TimeSpan value); + partial void OnStartTimeChanged(); + #endregion + + /// Initializes a new instance of the class. + public Shift() + { + _employeeDepartmentHistories = new EntitySet(new Action(this.Attach_EmployeeDepartmentHistories), new Action(this.Detach_EmployeeDepartmentHistories) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Shift = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_EmployeeDepartmentHistories(EmployeeDepartmentHistory entity) + { + this.SendPropertyChanging("EmployeeDepartmentHistories"); + entity.Shift = null; + } + + + #region Class Property Declarations + /// Gets or sets the EndTime field. Mapped on target field 'EndTime'. + public System.TimeSpan EndTime + { + get { return _endTime; } + set + { + if((_endTime != value)) + { + OnEndTimeChanging(value); + SendPropertyChanging("EndTime"); + _endTime = value; + SendPropertyChanged("EndTime"); + OnEndTimeChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the ShiftId field. Mapped on target field 'ShiftID'. + public System.Byte ShiftId + { + get { return _shiftId; } + set + { + if((_shiftId != value)) + { + OnShiftIdChanging(value); + SendPropertyChanging("ShiftId"); + _shiftId = value; + SendPropertyChanged("ShiftId"); + OnShiftIdChanged(); + } + } + } + + /// Gets or sets the StartTime field. Mapped on target field 'StartTime'. + public System.TimeSpan StartTime + { + get { return _startTime; } + set + { + if((_startTime != value)) + { + OnStartTimeChanging(value); + SendPropertyChanging("StartTime"); + _startTime = value; + SendPropertyChanged("StartTime"); + OnStartTimeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'EmployeeDepartmentHistory.Shift - Shift.EmployeeDepartmentHistories (m:1)' + public EntitySet EmployeeDepartmentHistories + { + get { return this._employeeDepartmentHistories; } + set { this._employeeDepartmentHistories.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ShipMethod.cs b/tests/AdventureWorks2008Model/EntityClasses/ShipMethod.cs new file mode 100644 index 0000000..9be26b2 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ShipMethod.cs @@ -0,0 +1,232 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ShipMethod', mapped on table 'AdventureWorks.Purchasing.ShipMethod'. + public partial class ShipMethod : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private System.Decimal _shipBase; + private System.Int32 _shipMethodId; + private System.Decimal _shipRate; + private EntitySet _purchaseOrderHeaders; + private EntitySet _salesOrderHeaders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnShipBaseChanging(System.Decimal value); + partial void OnShipBaseChanged(); + partial void OnShipMethodIdChanging(System.Int32 value); + partial void OnShipMethodIdChanged(); + partial void OnShipRateChanging(System.Decimal value); + partial void OnShipRateChanged(); + #endregion + + /// Initializes a new instance of the class. + public ShipMethod() + { + _purchaseOrderHeaders = new EntitySet(new Action(this.Attach_PurchaseOrderHeaders), new Action(this.Detach_PurchaseOrderHeaders) ); + _salesOrderHeaders = new EntitySet(new Action(this.Attach_SalesOrderHeaders), new Action(this.Detach_SalesOrderHeaders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.ShipMethod = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.ShipMethod = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.ShipMethod = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderHeaders(SalesOrderHeader entity) + { + this.SendPropertyChanging("SalesOrderHeaders"); + entity.ShipMethod = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the ShipBase field. Mapped on target field 'ShipBase'. + public System.Decimal ShipBase + { + get { return _shipBase; } + set + { + if((_shipBase != value)) + { + OnShipBaseChanging(value); + SendPropertyChanging("ShipBase"); + _shipBase = value; + SendPropertyChanged("ShipBase"); + OnShipBaseChanged(); + } + } + } + + /// Gets or sets the ShipMethodId field. Mapped on target field 'ShipMethodID'. + public System.Int32 ShipMethodId + { + get { return _shipMethodId; } + set + { + if((_shipMethodId != value)) + { + OnShipMethodIdChanging(value); + SendPropertyChanging("ShipMethodId"); + _shipMethodId = value; + SendPropertyChanged("ShipMethodId"); + OnShipMethodIdChanged(); + } + } + } + + /// Gets or sets the ShipRate field. Mapped on target field 'ShipRate'. + public System.Decimal ShipRate + { + get { return _shipRate; } + set + { + if((_shipRate != value)) + { + OnShipRateChanging(value); + SendPropertyChanging("ShipRate"); + _shipRate = value; + SendPropertyChanged("ShipRate"); + OnShipRateChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.ShipMethod - ShipMethod.PurchaseOrderHeaders (m:1)' + public EntitySet PurchaseOrderHeaders + { + get { return this._purchaseOrderHeaders; } + set { this._purchaseOrderHeaders.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderHeader.ShipMethod - ShipMethod.SalesOrderHeaders (m:1)' + public EntitySet SalesOrderHeaders + { + get { return this._salesOrderHeaders; } + set { this._salesOrderHeaders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/ShoppingCartItem.cs b/tests/AdventureWorks2008Model/EntityClasses/ShoppingCartItem.cs new file mode 100644 index 0000000..303a13b --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/ShoppingCartItem.cs @@ -0,0 +1,218 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'ShoppingCartItem', mapped on table 'AdventureWorks.Sales.ShoppingCartItem'. + public partial class ShoppingCartItem : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _dateCreated; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Int32 _quantity; + private System.String _shoppingCartId; + private System.Int32 _shoppingCartItemId; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDateCreatedChanging(System.DateTime value); + partial void OnDateCreatedChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnQuantityChanging(System.Int32 value); + partial void OnQuantityChanged(); + partial void OnShoppingCartIdChanging(System.String value); + partial void OnShoppingCartIdChanged(); + partial void OnShoppingCartItemIdChanging(System.Int32 value); + partial void OnShoppingCartItemIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public ShoppingCartItem() + { + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the DateCreated field. Mapped on target field 'DateCreated'. + public System.DateTime DateCreated + { + get { return _dateCreated; } + set + { + if((_dateCreated != value)) + { + OnDateCreatedChanging(value); + SendPropertyChanging("DateCreated"); + _dateCreated = value; + SendPropertyChanged("DateCreated"); + OnDateCreatedChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Quantity field. Mapped on target field 'Quantity'. + public System.Int32 Quantity + { + get { return _quantity; } + set + { + if((_quantity != value)) + { + OnQuantityChanging(value); + SendPropertyChanging("Quantity"); + _quantity = value; + SendPropertyChanged("Quantity"); + OnQuantityChanged(); + } + } + } + + /// Gets or sets the ShoppingCartId field. Mapped on target field 'ShoppingCartID'. + public System.String ShoppingCartId + { + get { return _shoppingCartId; } + set + { + if((_shoppingCartId != value)) + { + OnShoppingCartIdChanging(value); + SendPropertyChanging("ShoppingCartId"); + _shoppingCartId = value; + SendPropertyChanged("ShoppingCartId"); + OnShoppingCartIdChanged(); + } + } + } + + /// Gets or sets the ShoppingCartItemId field. Mapped on target field 'ShoppingCartItemID'. + public System.Int32 ShoppingCartItemId + { + get { return _shoppingCartItemId; } + set + { + if((_shoppingCartItemId != value)) + { + OnShoppingCartItemIdChanging(value); + SendPropertyChanging("ShoppingCartItemId"); + _shoppingCartItemId = value; + SendPropertyChanged("ShoppingCartItemId"); + OnShoppingCartItemIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ShoppingCartItem.Product - Product.ShoppingCartItems (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.ShoppingCartItems.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.ShoppingCartItems.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SpecialOffer.cs b/tests/AdventureWorks2008Model/EntityClasses/SpecialOffer.cs new file mode 100644 index 0000000..21e6818 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SpecialOffer.cs @@ -0,0 +1,307 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SpecialOffer', mapped on table 'AdventureWorks.Sales.SpecialOffer'. + public partial class SpecialOffer : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _category; + private System.String _description; + private System.Decimal _discountPct; + private System.DateTime _endDate; + private Nullable _maxQty; + private System.Int32 _minQty; + private System.DateTime _modifiedDate; + private System.Guid _rowguid; + private System.Int32 _specialOfferId; + private System.DateTime _startDate; + private System.String _type; + private EntitySet _specialOfferProducts; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCategoryChanging(System.String value); + partial void OnCategoryChanged(); + partial void OnDescriptionChanging(System.String value); + partial void OnDescriptionChanged(); + partial void OnDiscountPctChanging(System.Decimal value); + partial void OnDiscountPctChanged(); + partial void OnEndDateChanging(System.DateTime value); + partial void OnEndDateChanged(); + partial void OnMaxQtyChanging(Nullable value); + partial void OnMaxQtyChanged(); + partial void OnMinQtyChanging(System.Int32 value); + partial void OnMinQtyChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSpecialOfferIdChanging(System.Int32 value); + partial void OnSpecialOfferIdChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + partial void OnTypeChanging(System.String value); + partial void OnTypeChanged(); + #endregion + + /// Initializes a new instance of the class. + public SpecialOffer() + { + _specialOfferProducts = new EntitySet(new Action(this.Attach_SpecialOfferProducts), new Action(this.Detach_SpecialOfferProducts) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SpecialOfferProducts(SpecialOfferProduct entity) + { + this.SendPropertyChanging("SpecialOfferProducts"); + entity.SpecialOffer = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SpecialOfferProducts(SpecialOfferProduct entity) + { + this.SendPropertyChanging("SpecialOfferProducts"); + entity.SpecialOffer = null; + } + + + #region Class Property Declarations + /// Gets or sets the Category field. Mapped on target field 'Category'. + public System.String Category + { + get { return _category; } + set + { + if((_category != value)) + { + OnCategoryChanging(value); + SendPropertyChanging("Category"); + _category = value; + SendPropertyChanged("Category"); + OnCategoryChanged(); + } + } + } + + /// Gets or sets the Description field. Mapped on target field 'Description'. + public System.String Description + { + get { return _description; } + set + { + if((_description != value)) + { + OnDescriptionChanging(value); + SendPropertyChanging("Description"); + _description = value; + SendPropertyChanged("Description"); + OnDescriptionChanged(); + } + } + } + + /// Gets or sets the DiscountPct field. Mapped on target field 'DiscountPct'. + public System.Decimal DiscountPct + { + get { return _discountPct; } + set + { + if((_discountPct != value)) + { + OnDiscountPctChanging(value); + SendPropertyChanging("DiscountPct"); + _discountPct = value; + SendPropertyChanged("DiscountPct"); + OnDiscountPctChanged(); + } + } + } + + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public System.DateTime EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the MaxQty field. Mapped on target field 'MaxQty'. + public Nullable MaxQty + { + get { return _maxQty; } + set + { + if((_maxQty != value)) + { + OnMaxQtyChanging(value); + SendPropertyChanging("MaxQty"); + _maxQty = value; + SendPropertyChanged("MaxQty"); + OnMaxQtyChanged(); + } + } + } + + /// Gets or sets the MinQty field. Mapped on target field 'MinQty'. + public System.Int32 MinQty + { + get { return _minQty; } + set + { + if((_minQty != value)) + { + OnMinQtyChanging(value); + SendPropertyChanging("MinQty"); + _minQty = value; + SendPropertyChanged("MinQty"); + OnMinQtyChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SpecialOfferId field. Mapped on target field 'SpecialOfferID'. + public System.Int32 SpecialOfferId + { + get { return _specialOfferId; } + set + { + if((_specialOfferId != value)) + { + OnSpecialOfferIdChanging(value); + SendPropertyChanging("SpecialOfferId"); + _specialOfferId = value; + SendPropertyChanged("SpecialOfferId"); + OnSpecialOfferIdChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Gets or sets the Type field. Mapped on target field 'Type'. + public System.String Type + { + get { return _type; } + set + { + if((_type != value)) + { + OnTypeChanging(value); + SendPropertyChanging("Type"); + _type = value; + SendPropertyChanged("Type"); + OnTypeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SpecialOfferProduct.SpecialOffer - SpecialOffer.SpecialOfferProducts (m:1)' + public EntitySet SpecialOfferProducts + { + get { return this._specialOfferProducts; } + set { this._specialOfferProducts.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/SpecialOfferProduct.cs b/tests/AdventureWorks2008Model/EntityClasses/SpecialOfferProduct.cs new file mode 100644 index 0000000..655151b --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/SpecialOfferProduct.cs @@ -0,0 +1,239 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'SpecialOfferProduct', mapped on table 'AdventureWorks.Sales.SpecialOfferProduct'. + public partial class SpecialOfferProduct : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Guid _rowguid; + private System.Int32 _specialOfferId; + private EntityRef _product; + private EntitySet _salesOrderDetails; + private EntityRef _specialOffer; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSpecialOfferIdChanging(System.Int32 value); + partial void OnSpecialOfferIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public SpecialOfferProduct() + { + _product = default(EntityRef); + _salesOrderDetails = new EntitySet(new Action(this.Attach_SalesOrderDetails), new Action(this.Detach_SalesOrderDetails) ); + _specialOffer = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesOrderDetails(SalesOrderDetail entity) + { + this.SendPropertyChanging("SalesOrderDetails"); + entity.SpecialOfferProduct = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesOrderDetails(SalesOrderDetail entity) + { + this.SendPropertyChanging("SalesOrderDetails"); + entity.SpecialOfferProduct = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SpecialOfferId field. Mapped on target field 'SpecialOfferID'. + public System.Int32 SpecialOfferId + { + get { return _specialOfferId; } + set + { + if((_specialOfferId != value)) + { + if(_specialOffer.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSpecialOfferIdChanging(value); + SendPropertyChanging("SpecialOfferId"); + _specialOfferId = value; + SendPropertyChanged("SpecialOfferId"); + OnSpecialOfferIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SpecialOfferProduct.Product - Product.SpecialOfferProducts (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.SpecialOfferProducts.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.SpecialOfferProducts.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesOrderDetail.SpecialOfferProduct - SpecialOfferProduct.SalesOrderDetails (m:1)' + public EntitySet SalesOrderDetails + { + get { return this._salesOrderDetails; } + set { this._salesOrderDetails.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'SpecialOfferProduct.SpecialOffer - SpecialOffer.SpecialOfferProducts (m:1)' + public SpecialOffer SpecialOffer + { + get { return _specialOffer.Entity; } + set + { + SpecialOffer previousValue = _specialOffer.Entity; + if((previousValue != value) || (_specialOffer.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SpecialOffer"); + if(previousValue != null) + { + _specialOffer.Entity = null; + previousValue.SpecialOfferProducts.Remove(this); + } + _specialOffer.Entity = value; + if(value == null) + { + _specialOfferId = default(System.Int32); + } + else + { + value.SpecialOfferProducts.Add(this); + _specialOfferId = value.SpecialOfferId; + } + this.SendPropertyChanged("SpecialOffer"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/StateProvince.cs b/tests/AdventureWorks2008Model/EntityClasses/StateProvince.cs new file mode 100644 index 0000000..06aeef0 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/StateProvince.cs @@ -0,0 +1,344 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'StateProvince', mapped on table 'AdventureWorks.Person.StateProvince'. + public partial class StateProvince : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _countryRegionCode; + private System.Boolean _isOnlyStateProvinceFlag; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private System.String _stateProvinceCode; + private System.Int32 _stateProvinceId; + private System.Int32 _territoryId; + private EntitySet
_addresses; + private EntityRef _countryRegion; + private EntitySet _salesTaxRates; + private EntityRef _salesTerritory; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnCountryRegionCodeChanging(System.String value); + partial void OnCountryRegionCodeChanged(); + partial void OnIsOnlyStateProvinceFlagChanging(System.Boolean value); + partial void OnIsOnlyStateProvinceFlagChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnStateProvinceCodeChanging(System.String value); + partial void OnStateProvinceCodeChanged(); + partial void OnStateProvinceIdChanging(System.Int32 value); + partial void OnStateProvinceIdChanged(); + partial void OnTerritoryIdChanging(System.Int32 value); + partial void OnTerritoryIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public StateProvince() + { + _addresses = new EntitySet
(new Action
(this.Attach_Addresses), new Action
(this.Detach_Addresses) ); + _countryRegion = default(EntityRef); + _salesTaxRates = new EntitySet(new Action(this.Attach_SalesTaxRates), new Action(this.Detach_SalesTaxRates) ); + _salesTerritory = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Addresses(Address entity) + { + this.SendPropertyChanging("Addresses"); + entity.StateProvince = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Addresses(Address entity) + { + this.SendPropertyChanging("Addresses"); + entity.StateProvince = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_SalesTaxRates(SalesTaxRate entity) + { + this.SendPropertyChanging("SalesTaxRates"); + entity.StateProvince = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_SalesTaxRates(SalesTaxRate entity) + { + this.SendPropertyChanging("SalesTaxRates"); + entity.StateProvince = null; + } + + + #region Class Property Declarations + /// Gets or sets the CountryRegionCode field. Mapped on target field 'CountryRegionCode'. + public System.String CountryRegionCode + { + get { return _countryRegionCode; } + set + { + if((_countryRegionCode != value)) + { + if(_countryRegion.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnCountryRegionCodeChanging(value); + SendPropertyChanging("CountryRegionCode"); + _countryRegionCode = value; + SendPropertyChanged("CountryRegionCode"); + OnCountryRegionCodeChanged(); + } + } + } + + /// Gets or sets the IsOnlyStateProvinceFlag field. Mapped on target field 'IsOnlyStateProvinceFlag'. + public System.Boolean IsOnlyStateProvinceFlag + { + get { return _isOnlyStateProvinceFlag; } + set + { + if((_isOnlyStateProvinceFlag != value)) + { + OnIsOnlyStateProvinceFlagChanging(value); + SendPropertyChanging("IsOnlyStateProvinceFlag"); + _isOnlyStateProvinceFlag = value; + SendPropertyChanged("IsOnlyStateProvinceFlag"); + OnIsOnlyStateProvinceFlagChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the StateProvinceCode field. Mapped on target field 'StateProvinceCode'. + public System.String StateProvinceCode + { + get { return _stateProvinceCode; } + set + { + if((_stateProvinceCode != value)) + { + OnStateProvinceCodeChanging(value); + SendPropertyChanging("StateProvinceCode"); + _stateProvinceCode = value; + SendPropertyChanged("StateProvinceCode"); + OnStateProvinceCodeChanged(); + } + } + } + + /// Gets or sets the StateProvinceId field. Mapped on target field 'StateProvinceID'. + public System.Int32 StateProvinceId + { + get { return _stateProvinceId; } + set + { + if((_stateProvinceId != value)) + { + OnStateProvinceIdChanging(value); + SendPropertyChanging("StateProvinceId"); + _stateProvinceId = value; + SendPropertyChanged("StateProvinceId"); + OnStateProvinceIdChanged(); + } + } + } + + /// Gets or sets the TerritoryId field. Mapped on target field 'TerritoryID'. + public System.Int32 TerritoryId + { + get { return _territoryId; } + set + { + if((_territoryId != value)) + { + if(_salesTerritory.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnTerritoryIdChanging(value); + SendPropertyChanging("TerritoryId"); + _territoryId = value; + SendPropertyChanged("TerritoryId"); + OnTerritoryIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Address.StateProvince - StateProvince.Addresses (m:1)' + public EntitySet
Addresses + { + get { return this._addresses; } + set { this._addresses.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'StateProvince.CountryRegion - CountryRegion.StateProvinces (m:1)' + public CountryRegion CountryRegion + { + get { return _countryRegion.Entity; } + set + { + CountryRegion previousValue = _countryRegion.Entity; + if((previousValue != value) || (_countryRegion.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("CountryRegion"); + if(previousValue != null) + { + _countryRegion.Entity = null; + previousValue.StateProvinces.Remove(this); + } + _countryRegion.Entity = value; + if(value == null) + { + _countryRegionCode = default(System.String); + } + else + { + value.StateProvinces.Add(this); + _countryRegionCode = value.CountryRegionCode; + } + this.SendPropertyChanged("CountryRegion"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'SalesTaxRate.StateProvince - StateProvince.SalesTaxRates (m:1)' + public EntitySet SalesTaxRates + { + get { return this._salesTaxRates; } + set { this._salesTaxRates.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'StateProvince.SalesTerritory - SalesTerritory.StateProvinces (m:1)' + public SalesTerritory SalesTerritory + { + get { return _salesTerritory.Entity; } + set + { + SalesTerritory previousValue = _salesTerritory.Entity; + if((previousValue != value) || (_salesTerritory.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesTerritory"); + if(previousValue != null) + { + _salesTerritory.Entity = null; + previousValue.StateProvinces.Remove(this); + } + _salesTerritory.Entity = value; + if(value == null) + { + _territoryId = default(System.Int32); + } + else + { + value.StateProvinces.Add(this); + _territoryId = value.TerritoryId; + } + this.SendPropertyChanged("SalesTerritory"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Store.cs b/tests/AdventureWorks2008Model/EntityClasses/Store.cs new file mode 100644 index 0000000..57bae94 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Store.cs @@ -0,0 +1,279 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Store', mapped on table 'AdventureWorks.Sales.Store'. + public partial class Store : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Int32 _businessEntityId; + private System.String _demographics; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Guid _rowguid; + private Nullable _salesPersonId; + private EntityRef _businessEntity; + private EntitySet _customers; + private EntityRef _salesPerson; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnDemographicsChanging(System.String value); + partial void OnDemographicsChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnRowguidChanging(System.Guid value); + partial void OnRowguidChanged(); + partial void OnSalesPersonIdChanging(Nullable value); + partial void OnSalesPersonIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public Store() + { + _businessEntity = default(EntityRef); + _customers = new EntitySet(new Action(this.Attach_Customers), new Action(this.Detach_Customers) ); + _salesPerson = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.Store = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Customers(Customer entity) + { + this.SendPropertyChanging("Customers"); + entity.Store = null; + } + + + #region Class Property Declarations + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_businessEntity.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the Demographics field. Mapped on target field 'Demographics'. + public System.String Demographics + { + get { return _demographics; } + set + { + if((_demographics != value)) + { + OnDemographicsChanging(value); + SendPropertyChanging("Demographics"); + _demographics = value; + SendPropertyChanged("Demographics"); + OnDemographicsChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the Rowguid field. Mapped on target field 'rowguid'. + public System.Guid Rowguid + { + get { return _rowguid; } + set + { + if((_rowguid != value)) + { + OnRowguidChanging(value); + SendPropertyChanging("Rowguid"); + _rowguid = value; + SendPropertyChanged("Rowguid"); + OnRowguidChanged(); + } + } + } + + /// Gets or sets the SalesPersonId field. Mapped on target field 'SalesPersonID'. + public Nullable SalesPersonId + { + get { return _salesPersonId; } + set + { + if((_salesPersonId != value)) + { + if(_salesPerson.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnSalesPersonIdChanging(value); + SendPropertyChanging("SalesPersonId"); + _salesPersonId = value; + SendPropertyChanged("SalesPersonId"); + OnSalesPersonIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Store.BusinessEntity - BusinessEntity.Store (1:1)' + public BusinessEntity BusinessEntity + { + get { return _businessEntity.Entity; } + set + { + BusinessEntity previousValue = _businessEntity.Entity; + if((previousValue != value) || (_businessEntity.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("BusinessEntity"); + if(previousValue != null) + { + _businessEntity.Entity = null; + previousValue.Store=null; + } + _businessEntity.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.Store = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("BusinessEntity"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Customer.Store - Store.Customers (m:1)' + public EntitySet Customers + { + get { return this._customers; } + set { this._customers.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Store.SalesPerson - SalesPerson.Stores (m:1)' + public SalesPerson SalesPerson + { + get { return _salesPerson.Entity; } + set + { + SalesPerson previousValue = _salesPerson.Entity; + if((previousValue != value) || (_salesPerson.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("SalesPerson"); + if(previousValue != null) + { + _salesPerson.Entity = null; + previousValue.Stores.Remove(this); + } + _salesPerson.Entity = value; + if(value == null) + { + _salesPersonId = default(Nullable); + } + else + { + value.Stores.Add(this); + _salesPersonId = value.BusinessEntityId; + } + this.SendPropertyChanged("SalesPerson"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/TransactionHistory.cs b/tests/AdventureWorks2008Model/EntityClasses/TransactionHistory.cs new file mode 100644 index 0000000..25ea2fb --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/TransactionHistory.cs @@ -0,0 +1,278 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'TransactionHistory', mapped on table 'AdventureWorks.Production.TransactionHistory'. + public partial class TransactionHistory : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _actualCost; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Int32 _quantity; + private System.Int32 _referenceOrderId; + private System.Int32 _referenceOrderLineId; + private System.DateTime _transactionDate; + private System.Int32 _transactionId; + private System.String _transactionType; + private EntityRef _product; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnActualCostChanging(System.Decimal value); + partial void OnActualCostChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnQuantityChanging(System.Int32 value); + partial void OnQuantityChanged(); + partial void OnReferenceOrderIdChanging(System.Int32 value); + partial void OnReferenceOrderIdChanged(); + partial void OnReferenceOrderLineIdChanging(System.Int32 value); + partial void OnReferenceOrderLineIdChanged(); + partial void OnTransactionDateChanging(System.DateTime value); + partial void OnTransactionDateChanged(); + partial void OnTransactionIdChanging(System.Int32 value); + partial void OnTransactionIdChanged(); + partial void OnTransactionTypeChanging(System.String value); + partial void OnTransactionTypeChanged(); + #endregion + + /// Initializes a new instance of the class. + public TransactionHistory() + { + _product = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ActualCost field. Mapped on target field 'ActualCost'. + public System.Decimal ActualCost + { + get { return _actualCost; } + set + { + if((_actualCost != value)) + { + OnActualCostChanging(value); + SendPropertyChanging("ActualCost"); + _actualCost = value; + SendPropertyChanged("ActualCost"); + OnActualCostChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Quantity field. Mapped on target field 'Quantity'. + public System.Int32 Quantity + { + get { return _quantity; } + set + { + if((_quantity != value)) + { + OnQuantityChanging(value); + SendPropertyChanging("Quantity"); + _quantity = value; + SendPropertyChanged("Quantity"); + OnQuantityChanged(); + } + } + } + + /// Gets or sets the ReferenceOrderId field. Mapped on target field 'ReferenceOrderID'. + public System.Int32 ReferenceOrderId + { + get { return _referenceOrderId; } + set + { + if((_referenceOrderId != value)) + { + OnReferenceOrderIdChanging(value); + SendPropertyChanging("ReferenceOrderId"); + _referenceOrderId = value; + SendPropertyChanged("ReferenceOrderId"); + OnReferenceOrderIdChanged(); + } + } + } + + /// Gets or sets the ReferenceOrderLineId field. Mapped on target field 'ReferenceOrderLineID'. + public System.Int32 ReferenceOrderLineId + { + get { return _referenceOrderLineId; } + set + { + if((_referenceOrderLineId != value)) + { + OnReferenceOrderLineIdChanging(value); + SendPropertyChanging("ReferenceOrderLineId"); + _referenceOrderLineId = value; + SendPropertyChanged("ReferenceOrderLineId"); + OnReferenceOrderLineIdChanged(); + } + } + } + + /// Gets or sets the TransactionDate field. Mapped on target field 'TransactionDate'. + public System.DateTime TransactionDate + { + get { return _transactionDate; } + set + { + if((_transactionDate != value)) + { + OnTransactionDateChanging(value); + SendPropertyChanging("TransactionDate"); + _transactionDate = value; + SendPropertyChanged("TransactionDate"); + OnTransactionDateChanged(); + } + } + } + + /// Gets or sets the TransactionId field. Mapped on target field 'TransactionID'. + public System.Int32 TransactionId + { + get { return _transactionId; } + set + { + if((_transactionId != value)) + { + OnTransactionIdChanging(value); + SendPropertyChanging("TransactionId"); + _transactionId = value; + SendPropertyChanged("TransactionId"); + OnTransactionIdChanged(); + } + } + } + + /// Gets or sets the TransactionType field. Mapped on target field 'TransactionType'. + public System.String TransactionType + { + get { return _transactionType; } + set + { + if((_transactionType != value)) + { + OnTransactionTypeChanging(value); + SendPropertyChanging("TransactionType"); + _transactionType = value; + SendPropertyChanged("TransactionType"); + OnTransactionTypeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'TransactionHistory.Product - Product.TransactionHistories (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.TransactionHistories.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.TransactionHistories.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/TransactionHistoryArchive.cs b/tests/AdventureWorks2008Model/EntityClasses/TransactionHistoryArchive.cs new file mode 100644 index 0000000..e3e3695 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/TransactionHistoryArchive.cs @@ -0,0 +1,242 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'TransactionHistoryArchive', mapped on table 'AdventureWorks.Production.TransactionHistoryArchive'. + public partial class TransactionHistoryArchive : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.Decimal _actualCost; + private System.DateTime _modifiedDate; + private System.Int32 _productId; + private System.Int32 _quantity; + private System.Int32 _referenceOrderId; + private System.Int32 _referenceOrderLineId; + private System.DateTime _transactionDate; + private System.Int32 _transactionId; + private System.String _transactionType; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnActualCostChanging(System.Decimal value); + partial void OnActualCostChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnQuantityChanging(System.Int32 value); + partial void OnQuantityChanged(); + partial void OnReferenceOrderIdChanging(System.Int32 value); + partial void OnReferenceOrderIdChanged(); + partial void OnReferenceOrderLineIdChanging(System.Int32 value); + partial void OnReferenceOrderLineIdChanged(); + partial void OnTransactionDateChanging(System.DateTime value); + partial void OnTransactionDateChanged(); + partial void OnTransactionIdChanging(System.Int32 value); + partial void OnTransactionIdChanged(); + partial void OnTransactionTypeChanging(System.String value); + partial void OnTransactionTypeChanged(); + #endregion + + /// Initializes a new instance of the class. + public TransactionHistoryArchive() + { + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ActualCost field. Mapped on target field 'ActualCost'. + public System.Decimal ActualCost + { + get { return _actualCost; } + set + { + if((_actualCost != value)) + { + OnActualCostChanging(value); + SendPropertyChanging("ActualCost"); + _actualCost = value; + SendPropertyChanged("ActualCost"); + OnActualCostChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the Quantity field. Mapped on target field 'Quantity'. + public System.Int32 Quantity + { + get { return _quantity; } + set + { + if((_quantity != value)) + { + OnQuantityChanging(value); + SendPropertyChanging("Quantity"); + _quantity = value; + SendPropertyChanged("Quantity"); + OnQuantityChanged(); + } + } + } + + /// Gets or sets the ReferenceOrderId field. Mapped on target field 'ReferenceOrderID'. + public System.Int32 ReferenceOrderId + { + get { return _referenceOrderId; } + set + { + if((_referenceOrderId != value)) + { + OnReferenceOrderIdChanging(value); + SendPropertyChanging("ReferenceOrderId"); + _referenceOrderId = value; + SendPropertyChanged("ReferenceOrderId"); + OnReferenceOrderIdChanged(); + } + } + } + + /// Gets or sets the ReferenceOrderLineId field. Mapped on target field 'ReferenceOrderLineID'. + public System.Int32 ReferenceOrderLineId + { + get { return _referenceOrderLineId; } + set + { + if((_referenceOrderLineId != value)) + { + OnReferenceOrderLineIdChanging(value); + SendPropertyChanging("ReferenceOrderLineId"); + _referenceOrderLineId = value; + SendPropertyChanged("ReferenceOrderLineId"); + OnReferenceOrderLineIdChanged(); + } + } + } + + /// Gets or sets the TransactionDate field. Mapped on target field 'TransactionDate'. + public System.DateTime TransactionDate + { + get { return _transactionDate; } + set + { + if((_transactionDate != value)) + { + OnTransactionDateChanging(value); + SendPropertyChanging("TransactionDate"); + _transactionDate = value; + SendPropertyChanged("TransactionDate"); + OnTransactionDateChanged(); + } + } + } + + /// Gets or sets the TransactionId field. Mapped on target field 'TransactionID'. + public System.Int32 TransactionId + { + get { return _transactionId; } + set + { + if((_transactionId != value)) + { + OnTransactionIdChanging(value); + SendPropertyChanging("TransactionId"); + _transactionId = value; + SendPropertyChanged("TransactionId"); + OnTransactionIdChanged(); + } + } + } + + /// Gets or sets the TransactionType field. Mapped on target field 'TransactionType'. + public System.String TransactionType + { + get { return _transactionType; } + set + { + if((_transactionType != value)) + { + OnTransactionTypeChanging(value); + SendPropertyChanging("TransactionType"); + _transactionType = value; + SendPropertyChanged("TransactionType"); + OnTransactionTypeChanged(); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/UnitMeasure.cs b/tests/AdventureWorks2008Model/EntityClasses/UnitMeasure.cs new file mode 100644 index 0000000..df03987 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/UnitMeasure.cs @@ -0,0 +1,222 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'UnitMeasure', mapped on table 'AdventureWorks.Production.UnitMeasure'. + public partial class UnitMeasure : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _modifiedDate; + private System.String _name; + private System.String _unitMeasureCode; + private EntitySet _billOfMaterials; + private EntitySet _products; + private EntitySet _products1; + private EntitySet _productVendors; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnUnitMeasureCodeChanging(System.String value); + partial void OnUnitMeasureCodeChanged(); + #endregion + + /// Initializes a new instance of the class. + public UnitMeasure() + { + _billOfMaterials = new EntitySet(new Action(this.Attach_BillOfMaterials), new Action(this.Detach_BillOfMaterials) ); + _products = new EntitySet(new Action(this.Attach_Products), new Action(this.Detach_Products) ); + _products1 = new EntitySet(new Action(this.Attach_Products1), new Action(this.Detach_Products1) ); + _productVendors = new EntitySet(new Action(this.Attach_ProductVendors), new Action(this.Detach_ProductVendors) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_BillOfMaterials(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials"); + entity.UnitMeasure = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_BillOfMaterials(BillOfMaterial entity) + { + this.SendPropertyChanging("BillOfMaterials"); + entity.UnitMeasure = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.UnitMeasure = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Products(Product entity) + { + this.SendPropertyChanging("Products"); + entity.UnitMeasure = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_Products1(Product entity) + { + this.SendPropertyChanging("Products1"); + entity.UnitMeasure1 = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_Products1(Product entity) + { + this.SendPropertyChanging("Products1"); + entity.UnitMeasure1 = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.UnitMeasure = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.UnitMeasure = null; + } + + + #region Class Property Declarations + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the UnitMeasureCode field. Mapped on target field 'UnitMeasureCode'. + public System.String UnitMeasureCode + { + get { return _unitMeasureCode; } + set + { + if((_unitMeasureCode != value)) + { + OnUnitMeasureCodeChanging(value); + SendPropertyChanging("UnitMeasureCode"); + _unitMeasureCode = value; + SendPropertyChanged("UnitMeasureCode"); + OnUnitMeasureCodeChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'BillOfMaterial.UnitMeasure - UnitMeasure.BillOfMaterials (m:1)' + public EntitySet BillOfMaterials + { + get { return this._billOfMaterials; } + set { this._billOfMaterials.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Product.UnitMeasure - UnitMeasure.Products (m:1)' + public EntitySet Products + { + get { return this._products; } + set { this._products.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'Product.UnitMeasure1 - UnitMeasure.Products1 (m:1)' + public EntitySet Products1 + { + get { return this._products1; } + set { this._products1.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.UnitMeasure - UnitMeasure.ProductVendors (m:1)' + public EntitySet ProductVendors + { + get { return this._productVendors; } + set { this._productVendors.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/Vendor.cs b/tests/AdventureWorks2008Model/EntityClasses/Vendor.cs new file mode 100644 index 0000000..6869c52 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/Vendor.cs @@ -0,0 +1,308 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'Vendor', mapped on table 'AdventureWorks.Purchasing.Vendor'. + public partial class Vendor : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.String _accountNumber; + private System.Boolean _activeFlag; + private System.Int32 _businessEntityId; + private System.Byte _creditRating; + private System.DateTime _modifiedDate; + private System.String _name; + private System.Boolean _preferredVendorStatus; + private System.String _purchasingWebServiceUrl; + private EntityRef _businessEntity; + private EntitySet _productVendors; + private EntitySet _purchaseOrderHeaders; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnAccountNumberChanging(System.String value); + partial void OnAccountNumberChanged(); + partial void OnActiveFlagChanging(System.Boolean value); + partial void OnActiveFlagChanged(); + partial void OnBusinessEntityIdChanging(System.Int32 value); + partial void OnBusinessEntityIdChanged(); + partial void OnCreditRatingChanging(System.Byte value); + partial void OnCreditRatingChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnNameChanging(System.String value); + partial void OnNameChanged(); + partial void OnPreferredVendorStatusChanging(System.Boolean value); + partial void OnPreferredVendorStatusChanged(); + partial void OnPurchasingWebServiceUrlChanging(System.String value); + partial void OnPurchasingWebServiceUrlChanged(); + #endregion + + /// Initializes a new instance of the class. + public Vendor() + { + _businessEntity = default(EntityRef); + _productVendors = new EntitySet(new Action(this.Attach_ProductVendors), new Action(this.Detach_ProductVendors) ); + _purchaseOrderHeaders = new EntitySet(new Action(this.Attach_PurchaseOrderHeaders), new Action(this.Detach_PurchaseOrderHeaders) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.Vendor = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_ProductVendors(ProductVendor entity) + { + this.SendPropertyChanging("ProductVendors"); + entity.Vendor = null; + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.Vendor = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_PurchaseOrderHeaders(PurchaseOrderHeader entity) + { + this.SendPropertyChanging("PurchaseOrderHeaders"); + entity.Vendor = null; + } + + + #region Class Property Declarations + /// Gets or sets the AccountNumber field. Mapped on target field 'AccountNumber'. + public System.String AccountNumber + { + get { return _accountNumber; } + set + { + if((_accountNumber != value)) + { + OnAccountNumberChanging(value); + SendPropertyChanging("AccountNumber"); + _accountNumber = value; + SendPropertyChanged("AccountNumber"); + OnAccountNumberChanged(); + } + } + } + + /// Gets or sets the ActiveFlag field. Mapped on target field 'ActiveFlag'. + public System.Boolean ActiveFlag + { + get { return _activeFlag; } + set + { + if((_activeFlag != value)) + { + OnActiveFlagChanging(value); + SendPropertyChanging("ActiveFlag"); + _activeFlag = value; + SendPropertyChanged("ActiveFlag"); + OnActiveFlagChanged(); + } + } + } + + /// Gets or sets the BusinessEntityId field. Mapped on target field 'BusinessEntityID'. + public System.Int32 BusinessEntityId + { + get { return _businessEntityId; } + set + { + if((_businessEntityId != value)) + { + if(_businessEntity.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnBusinessEntityIdChanging(value); + SendPropertyChanging("BusinessEntityId"); + _businessEntityId = value; + SendPropertyChanged("BusinessEntityId"); + OnBusinessEntityIdChanged(); + } + } + } + + /// Gets or sets the CreditRating field. Mapped on target field 'CreditRating'. + public System.Byte CreditRating + { + get { return _creditRating; } + set + { + if((_creditRating != value)) + { + OnCreditRatingChanging(value); + SendPropertyChanging("CreditRating"); + _creditRating = value; + SendPropertyChanged("CreditRating"); + OnCreditRatingChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the Name field. Mapped on target field 'Name'. + public System.String Name + { + get { return _name; } + set + { + if((_name != value)) + { + OnNameChanging(value); + SendPropertyChanging("Name"); + _name = value; + SendPropertyChanged("Name"); + OnNameChanged(); + } + } + } + + /// Gets or sets the PreferredVendorStatus field. Mapped on target field 'PreferredVendorStatus'. + public System.Boolean PreferredVendorStatus + { + get { return _preferredVendorStatus; } + set + { + if((_preferredVendorStatus != value)) + { + OnPreferredVendorStatusChanging(value); + SendPropertyChanging("PreferredVendorStatus"); + _preferredVendorStatus = value; + SendPropertyChanged("PreferredVendorStatus"); + OnPreferredVendorStatusChanged(); + } + } + } + + /// Gets or sets the PurchasingWebServiceUrl field. Mapped on target field 'PurchasingWebServiceURL'. + public System.String PurchasingWebServiceUrl + { + get { return _purchasingWebServiceUrl; } + set + { + if((_purchasingWebServiceUrl != value)) + { + OnPurchasingWebServiceUrlChanging(value); + SendPropertyChanging("PurchasingWebServiceUrl"); + _purchasingWebServiceUrl = value; + SendPropertyChanged("PurchasingWebServiceUrl"); + OnPurchasingWebServiceUrlChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'Vendor.BusinessEntity - BusinessEntity.Vendor (1:1)' + public BusinessEntity BusinessEntity + { + get { return _businessEntity.Entity; } + set + { + BusinessEntity previousValue = _businessEntity.Entity; + if((previousValue != value) || (_businessEntity.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("BusinessEntity"); + if(previousValue != null) + { + _businessEntity.Entity = null; + previousValue.Vendor=null; + } + _businessEntity.Entity = value; + if(value==null) + { + _businessEntityId = default(System.Int32); + } + else + { + value.Vendor = this; + _businessEntityId = value.BusinessEntityId; + } + this.SendPropertyChanged("BusinessEntity"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'ProductVendor.Vendor - Vendor.ProductVendors (m:1)' + public EntitySet ProductVendors + { + get { return this._productVendors; } + set { this._productVendors.Assign(value); } + } + + /// Represents the navigator which is mapped onto the association 'PurchaseOrderHeader.Vendor - Vendor.PurchaseOrderHeaders (m:1)' + public EntitySet PurchaseOrderHeaders + { + get { return this._purchaseOrderHeaders; } + set { this._purchaseOrderHeaders.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/WorkOrder.cs b/tests/AdventureWorks2008Model/EntityClasses/WorkOrder.cs new file mode 100644 index 0000000..54f4180 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/WorkOrder.cs @@ -0,0 +1,348 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'WorkOrder', mapped on table 'AdventureWorks.Production.WorkOrder'. + public partial class WorkOrder : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private System.DateTime _dueDate; + private Nullable _endDate; + private System.DateTime _modifiedDate; + private System.Int32 _orderQty; + private System.Int32 _productId; + private System.Int16 _scrappedQty; + private Nullable _scrapReasonId; + private System.DateTime _startDate; + private System.Int32 _stockedQty; + private System.Int32 _workOrderId; + private EntityRef _product; + private EntityRef _scrapReason; + private EntitySet _workOrderRoutings; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDueDateChanging(System.DateTime value); + partial void OnDueDateChanged(); + partial void OnEndDateChanging(Nullable value); + partial void OnEndDateChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOrderQtyChanging(System.Int32 value); + partial void OnOrderQtyChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnScrappedQtyChanging(System.Int16 value); + partial void OnScrappedQtyChanged(); + partial void OnScrapReasonIdChanging(Nullable value); + partial void OnScrapReasonIdChanged(); + partial void OnStartDateChanging(System.DateTime value); + partial void OnStartDateChanged(); + partial void OnStockedQtyChanging(System.Int32 value); + partial void OnStockedQtyChanged(); + partial void OnWorkOrderIdChanging(System.Int32 value); + partial void OnWorkOrderIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public WorkOrder() + { + _product = default(EntityRef); + _scrapReason = default(EntityRef); + _workOrderRoutings = new EntitySet(new Action(this.Attach_WorkOrderRoutings), new Action(this.Detach_WorkOrderRoutings) ); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// Attaches this instance to the entity specified as an associated entity + /// The related entity to attach to + private void Attach_WorkOrderRoutings(WorkOrderRouting entity) + { + this.SendPropertyChanging("WorkOrderRoutings"); + entity.WorkOrder = this; + } + + /// Detaches this instance from the entity specified so it's no longer an associated entity + /// The related entity to detach from + private void Detach_WorkOrderRoutings(WorkOrderRouting entity) + { + this.SendPropertyChanging("WorkOrderRoutings"); + entity.WorkOrder = null; + } + + + #region Class Property Declarations + /// Gets or sets the DueDate field. Mapped on target field 'DueDate'. + public System.DateTime DueDate + { + get { return _dueDate; } + set + { + if((_dueDate != value)) + { + OnDueDateChanging(value); + SendPropertyChanging("DueDate"); + _dueDate = value; + SendPropertyChanged("DueDate"); + OnDueDateChanged(); + } + } + } + + /// Gets or sets the EndDate field. Mapped on target field 'EndDate'. + public Nullable EndDate + { + get { return _endDate; } + set + { + if((_endDate != value)) + { + OnEndDateChanging(value); + SendPropertyChanging("EndDate"); + _endDate = value; + SendPropertyChanged("EndDate"); + OnEndDateChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OrderQty field. Mapped on target field 'OrderQty'. + public System.Int32 OrderQty + { + get { return _orderQty; } + set + { + if((_orderQty != value)) + { + OnOrderQtyChanging(value); + SendPropertyChanging("OrderQty"); + _orderQty = value; + SendPropertyChanged("OrderQty"); + OnOrderQtyChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + if(_product.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the ScrappedQty field. Mapped on target field 'ScrappedQty'. + public System.Int16 ScrappedQty + { + get { return _scrappedQty; } + set + { + if((_scrappedQty != value)) + { + OnScrappedQtyChanging(value); + SendPropertyChanging("ScrappedQty"); + _scrappedQty = value; + SendPropertyChanged("ScrappedQty"); + OnScrappedQtyChanged(); + } + } + } + + /// Gets or sets the ScrapReasonId field. Mapped on target field 'ScrapReasonID'. + public Nullable ScrapReasonId + { + get { return _scrapReasonId; } + set + { + if((_scrapReasonId != value)) + { + if(_scrapReason.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnScrapReasonIdChanging(value); + SendPropertyChanging("ScrapReasonId"); + _scrapReasonId = value; + SendPropertyChanged("ScrapReasonId"); + OnScrapReasonIdChanged(); + } + } + } + + /// Gets or sets the StartDate field. Mapped on target field 'StartDate'. + public System.DateTime StartDate + { + get { return _startDate; } + set + { + if((_startDate != value)) + { + OnStartDateChanging(value); + SendPropertyChanging("StartDate"); + _startDate = value; + SendPropertyChanged("StartDate"); + OnStartDateChanged(); + } + } + } + + /// Gets or sets the StockedQty field. Mapped on target field 'StockedQty'. + public System.Int32 StockedQty + { + get { return _stockedQty; } + } + + /// Gets or sets the WorkOrderId field. Mapped on target field 'WorkOrderID'. + public System.Int32 WorkOrderId + { + get { return _workOrderId; } + set + { + if((_workOrderId != value)) + { + OnWorkOrderIdChanging(value); + SendPropertyChanging("WorkOrderId"); + _workOrderId = value; + SendPropertyChanged("WorkOrderId"); + OnWorkOrderIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrder.Product - Product.WorkOrders (m:1)' + public Product Product + { + get { return _product.Entity; } + set + { + Product previousValue = _product.Entity; + if((previousValue != value) || (_product.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Product"); + if(previousValue != null) + { + _product.Entity = null; + previousValue.WorkOrders.Remove(this); + } + _product.Entity = value; + if(value == null) + { + _productId = default(System.Int32); + } + else + { + value.WorkOrders.Add(this); + _productId = value.ProductId; + } + this.SendPropertyChanged("Product"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrder.ScrapReason - ScrapReason.WorkOrders (m:1)' + public ScrapReason ScrapReason + { + get { return _scrapReason.Entity; } + set + { + ScrapReason previousValue = _scrapReason.Entity; + if((previousValue != value) || (_scrapReason.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("ScrapReason"); + if(previousValue != null) + { + _scrapReason.Entity = null; + previousValue.WorkOrders.Remove(this); + } + _scrapReason.Entity = value; + if(value == null) + { + _scrapReasonId = default(Nullable); + } + else + { + value.WorkOrders.Add(this); + _scrapReasonId = value.ScrapReasonId; + } + this.SendPropertyChanged("ScrapReason"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrderRouting.WorkOrder - WorkOrder.WorkOrderRoutings (m:1)' + public EntitySet WorkOrderRoutings + { + get { return this._workOrderRoutings; } + set { this._workOrderRoutings.Assign(value); } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/EntityClasses/WorkOrderRouting.cs b/tests/AdventureWorks2008Model/EntityClasses/WorkOrderRouting.cs new file mode 100644 index 0000000..3c7acc3 --- /dev/null +++ b/tests/AdventureWorks2008Model/EntityClasses/WorkOrderRouting.cs @@ -0,0 +1,374 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.EntityClasses +{ + /// Class which represents the entity 'WorkOrderRouting', mapped on table 'AdventureWorks.Production.WorkOrderRouting'. + public partial class WorkOrderRouting : INotifyPropertyChanging, INotifyPropertyChanged + { + #region Events + /// Event which is raised when a property value is changing. + public event PropertyChangingEventHandler PropertyChanging; + /// Event which is raised when a property value changes. + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + #region Class Member Declarations + private Nullable _actualCost; + private Nullable _actualEndDate; + private Nullable _actualResourceHrs; + private Nullable _actualStartDate; + private System.Int16 _locationId; + private System.DateTime _modifiedDate; + private System.Int16 _operationSequence; + private System.Decimal _plannedCost; + private System.Int32 _productId; + private System.DateTime _scheduledEndDate; + private System.DateTime _scheduledStartDate; + private System.Int32 _workOrderId; + private EntityRef _location; + private EntityRef _workOrder; + #endregion + + #region Extensibility Method Definitions + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnActualCostChanging(Nullable value); + partial void OnActualCostChanged(); + partial void OnActualEndDateChanging(Nullable value); + partial void OnActualEndDateChanged(); + partial void OnActualResourceHrsChanging(Nullable value); + partial void OnActualResourceHrsChanged(); + partial void OnActualStartDateChanging(Nullable value); + partial void OnActualStartDateChanged(); + partial void OnLocationIdChanging(System.Int16 value); + partial void OnLocationIdChanged(); + partial void OnModifiedDateChanging(System.DateTime value); + partial void OnModifiedDateChanged(); + partial void OnOperationSequenceChanging(System.Int16 value); + partial void OnOperationSequenceChanged(); + partial void OnPlannedCostChanging(System.Decimal value); + partial void OnPlannedCostChanged(); + partial void OnProductIdChanging(System.Int32 value); + partial void OnProductIdChanged(); + partial void OnScheduledEndDateChanging(System.DateTime value); + partial void OnScheduledEndDateChanged(); + partial void OnScheduledStartDateChanging(System.DateTime value); + partial void OnScheduledStartDateChanged(); + partial void OnWorkOrderIdChanging(System.Int32 value); + partial void OnWorkOrderIdChanged(); + #endregion + + /// Initializes a new instance of the class. + public WorkOrderRouting() + { + _location = default(EntityRef); + _workOrder = default(EntityRef); + OnCreated(); + } + + /// Raises the PropertyChanging event + /// name of the property which is changing + protected virtual void SendPropertyChanging(string propertyName) + { + if((this.PropertyChanging != null)) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); + } + } + + /// Raises the PropertyChanged event for the property specified + /// name of the property which was changed + protected virtual void SendPropertyChanged(string propertyName) + { + if((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + #region Class Property Declarations + /// Gets or sets the ActualCost field. Mapped on target field 'ActualCost'. + public Nullable ActualCost + { + get { return _actualCost; } + set + { + if((_actualCost != value)) + { + OnActualCostChanging(value); + SendPropertyChanging("ActualCost"); + _actualCost = value; + SendPropertyChanged("ActualCost"); + OnActualCostChanged(); + } + } + } + + /// Gets or sets the ActualEndDate field. Mapped on target field 'ActualEndDate'. + public Nullable ActualEndDate + { + get { return _actualEndDate; } + set + { + if((_actualEndDate != value)) + { + OnActualEndDateChanging(value); + SendPropertyChanging("ActualEndDate"); + _actualEndDate = value; + SendPropertyChanged("ActualEndDate"); + OnActualEndDateChanged(); + } + } + } + + /// Gets or sets the ActualResourceHrs field. Mapped on target field 'ActualResourceHrs'. + public Nullable ActualResourceHrs + { + get { return _actualResourceHrs; } + set + { + if((_actualResourceHrs != value)) + { + OnActualResourceHrsChanging(value); + SendPropertyChanging("ActualResourceHrs"); + _actualResourceHrs = value; + SendPropertyChanged("ActualResourceHrs"); + OnActualResourceHrsChanged(); + } + } + } + + /// Gets or sets the ActualStartDate field. Mapped on target field 'ActualStartDate'. + public Nullable ActualStartDate + { + get { return _actualStartDate; } + set + { + if((_actualStartDate != value)) + { + OnActualStartDateChanging(value); + SendPropertyChanging("ActualStartDate"); + _actualStartDate = value; + SendPropertyChanged("ActualStartDate"); + OnActualStartDateChanged(); + } + } + } + + /// Gets or sets the LocationId field. Mapped on target field 'LocationID'. + public System.Int16 LocationId + { + get { return _locationId; } + set + { + if((_locationId != value)) + { + if(_location.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnLocationIdChanging(value); + SendPropertyChanging("LocationId"); + _locationId = value; + SendPropertyChanged("LocationId"); + OnLocationIdChanged(); + } + } + } + + /// Gets or sets the ModifiedDate field. Mapped on target field 'ModifiedDate'. + public System.DateTime ModifiedDate + { + get { return _modifiedDate; } + set + { + if((_modifiedDate != value)) + { + OnModifiedDateChanging(value); + SendPropertyChanging("ModifiedDate"); + _modifiedDate = value; + SendPropertyChanged("ModifiedDate"); + OnModifiedDateChanged(); + } + } + } + + /// Gets or sets the OperationSequence field. Mapped on target field 'OperationSequence'. + public System.Int16 OperationSequence + { + get { return _operationSequence; } + set + { + if((_operationSequence != value)) + { + OnOperationSequenceChanging(value); + SendPropertyChanging("OperationSequence"); + _operationSequence = value; + SendPropertyChanged("OperationSequence"); + OnOperationSequenceChanged(); + } + } + } + + /// Gets or sets the PlannedCost field. Mapped on target field 'PlannedCost'. + public System.Decimal PlannedCost + { + get { return _plannedCost; } + set + { + if((_plannedCost != value)) + { + OnPlannedCostChanging(value); + SendPropertyChanging("PlannedCost"); + _plannedCost = value; + SendPropertyChanged("PlannedCost"); + OnPlannedCostChanged(); + } + } + } + + /// Gets or sets the ProductId field. Mapped on target field 'ProductID'. + public System.Int32 ProductId + { + get { return _productId; } + set + { + if((_productId != value)) + { + OnProductIdChanging(value); + SendPropertyChanging("ProductId"); + _productId = value; + SendPropertyChanged("ProductId"); + OnProductIdChanged(); + } + } + } + + /// Gets or sets the ScheduledEndDate field. Mapped on target field 'ScheduledEndDate'. + public System.DateTime ScheduledEndDate + { + get { return _scheduledEndDate; } + set + { + if((_scheduledEndDate != value)) + { + OnScheduledEndDateChanging(value); + SendPropertyChanging("ScheduledEndDate"); + _scheduledEndDate = value; + SendPropertyChanged("ScheduledEndDate"); + OnScheduledEndDateChanged(); + } + } + } + + /// Gets or sets the ScheduledStartDate field. Mapped on target field 'ScheduledStartDate'. + public System.DateTime ScheduledStartDate + { + get { return _scheduledStartDate; } + set + { + if((_scheduledStartDate != value)) + { + OnScheduledStartDateChanging(value); + SendPropertyChanging("ScheduledStartDate"); + _scheduledStartDate = value; + SendPropertyChanged("ScheduledStartDate"); + OnScheduledStartDateChanged(); + } + } + } + + /// Gets or sets the WorkOrderId field. Mapped on target field 'WorkOrderID'. + public System.Int32 WorkOrderId + { + get { return _workOrderId; } + set + { + if((_workOrderId != value)) + { + if(_workOrder.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + OnWorkOrderIdChanging(value); + SendPropertyChanging("WorkOrderId"); + _workOrderId = value; + SendPropertyChanged("WorkOrderId"); + OnWorkOrderIdChanged(); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrderRouting.Location - Location.WorkOrderRoutings (m:1)' + public Location Location + { + get { return _location.Entity; } + set + { + Location previousValue = _location.Entity; + if((previousValue != value) || (_location.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("Location"); + if(previousValue != null) + { + _location.Entity = null; + previousValue.WorkOrderRoutings.Remove(this); + } + _location.Entity = value; + if(value == null) + { + _locationId = default(System.Int16); + } + else + { + value.WorkOrderRoutings.Add(this); + _locationId = value.LocationId; + } + this.SendPropertyChanged("Location"); + } + } + } + + /// Represents the navigator which is mapped onto the association 'WorkOrderRouting.WorkOrder - WorkOrder.WorkOrderRoutings (m:1)' + public WorkOrder WorkOrder + { + get { return _workOrder.Entity; } + set + { + WorkOrder previousValue = _workOrder.Entity; + if((previousValue != value) || (_workOrder.HasLoadedOrAssignedValue == false)) + { + this.SendPropertyChanging("WorkOrder"); + if(previousValue != null) + { + _workOrder.Entity = null; + previousValue.WorkOrderRoutings.Remove(this); + } + _workOrder.Entity = value; + if(value == null) + { + _workOrderId = default(System.Int32); + } + else + { + value.WorkOrderRoutings.Add(this); + _workOrderId = value.WorkOrderId; + } + this.SendPropertyChanged("WorkOrder"); + } + } + } + + #endregion + } +} +#pragma warning restore 0649 \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/Properties/AssemblyInfo.cs b/tests/AdventureWorks2008Model/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7486c07 --- /dev/null +++ b/tests/AdventureWorks2008Model/Properties/AssemblyInfo.cs @@ -0,0 +1,25 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Linq to Sql 2 AdventureWorks 2008 model")] +[assembly: AssemblyDescription("AdventureWorks 2008 model for read tests for Linq to Sql 2, a full featured ORM based on Linq to Sql.")] +[assembly: AssemblyConfiguration(".NET 4.5+")] +[assembly: AssemblyCompany("Solutions Design bv")] +[assembly: AssemblyProduct("Linq to Sql 2")] +[assembly: AssemblyCopyright("(c) Solutions Design bv")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: System.CLSCompliant(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/AdventureWorks2008Model/SqlServerTypes/Loader.cs b/tests/AdventureWorks2008Model/SqlServerTypes/Loader.cs new file mode 100644 index 0000000..0dc61f6 --- /dev/null +++ b/tests/AdventureWorks2008Model/SqlServerTypes/Loader.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace SqlServerTypes +{ + /// + /// Utility methods related to CLR Types for SQL Server + /// + internal class Utilities + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr LoadLibrary(string libname); + + /// + /// Loads the required native assemblies for the current architecture (x86 or x64) + /// + /// + /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications + /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications. + /// + public static void LoadNativeAssemblies(string rootApplicationPath) + { + var nativeBinaryPath = IntPtr.Size > 4 + ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\") + : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\"); + + LoadNativeAssembly(nativeBinaryPath, "msvcr100.dll"); + LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial110.dll"); + } + + private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName) + { + var path = Path.Combine(nativeBinaryPath, assemblyName); + var ptr = LoadLibrary(path); + if (ptr == IntPtr.Zero) + { + throw new Exception(string.Format( + "Error loading {0} (ErrorCode: {1})", + assemblyName, + Marshal.GetLastWin32Error())); + } + } + } +} \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/SqlServerTypes/readme.htm b/tests/AdventureWorks2008Model/SqlServerTypes/readme.htm new file mode 100644 index 0000000..0f9eade --- /dev/null +++ b/tests/AdventureWorks2008Model/SqlServerTypes/readme.htm @@ -0,0 +1,39 @@ + + + + Microsoft.SqlServer.Types + + + +
+

Action required to load native assemblies

+

+ To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial110.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr100.dll is also included in case the C++ runtime is not installed. +

+

+ You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture). +

+

ASP.NET applications

+

+ For ASP.NET applications, add the following line of code to the Application_Start method in Global.asax.cs: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
+

+

Desktop applications

+

+ For desktop applications, add the following line of code to run before any spatial operations are performed: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
+

+
+ + \ No newline at end of file diff --git a/tests/AdventureWorks2008Model/TypedViewClasses/BillOfRightsResultTypedViewRow.cs b/tests/AdventureWorks2008Model/TypedViewClasses/BillOfRightsResultTypedViewRow.cs new file mode 100644 index 0000000..d7fc414 --- /dev/null +++ b/tests/AdventureWorks2008Model/TypedViewClasses/BillOfRightsResultTypedViewRow.cs @@ -0,0 +1,88 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.TypedViewClasses +{ + /// Class which represents a row in the typed view 'BillOfRightsResult'. + public partial class BillOfRightsResultTypedViewRow + { + #region Class Member Declarations + private Nullable _bomlevel; + private System.String _componentDesc; + private Nullable _componentId; + private Nullable _listPrice; + private Nullable _productAssemblyId; + private Nullable _recursionLevel; + private Nullable _standardCost; + private Nullable _totalQuantity; + #endregion + + #region Extensibility Method Definitions + partial void OnCreated(); + #endregion + + /// Initializes a new instance of the class. + public BillOfRightsResultTypedViewRow() + { + OnCreated(); + } + + #region Class Property Declarations + /// Gets the Bomlevel field. Mapped onto target field / column 'BOMLevel'. + public Nullable Bomlevel + { + get { return _bomlevel; } + } + + /// Gets the ComponentDesc field. Mapped onto target field / column 'ComponentDesc'. + public System.String ComponentDesc + { + get { return _componentDesc; } + } + + /// Gets the ComponentId field. Mapped onto target field / column 'ComponentID'. + public Nullable ComponentId + { + get { return _componentId; } + } + + /// Gets the ListPrice field. Mapped onto target field / column 'ListPrice'. + public Nullable ListPrice + { + get { return _listPrice; } + } + + /// Gets the ProductAssemblyId field. Mapped onto target field / column 'ProductAssemblyID'. + public Nullable ProductAssemblyId + { + get { return _productAssemblyId; } + } + + /// Gets the RecursionLevel field. Mapped onto target field / column 'RecursionLevel'. + public Nullable RecursionLevel + { + get { return _recursionLevel; } + } + + /// Gets the StandardCost field. Mapped onto target field / column 'StandardCost'. + public Nullable StandardCost + { + get { return _standardCost; } + } + + /// Gets the TotalQuantity field. Mapped onto target field / column 'TotalQuantity'. + public Nullable TotalQuantity + { + get { return _totalQuantity; } + } + + #endregion + } +} +#pragma warning restore 0649 diff --git a/tests/AdventureWorks2008Model/TypedViewClasses/UfnGetContactInformationResultTypedViewRow.cs b/tests/AdventureWorks2008Model/TypedViewClasses/UfnGetContactInformationResultTypedViewRow.cs new file mode 100644 index 0000000..1aa96e4 --- /dev/null +++ b/tests/AdventureWorks2008Model/TypedViewClasses/UfnGetContactInformationResultTypedViewRow.cs @@ -0,0 +1,67 @@ +#pragma warning disable 0649 +//------------------------------------------------------------------------------ +// This code was generated by LLBLGen Pro v4.2. +//------------------------------------------------------------------------------ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; +using System.ComponentModel; + +namespace ReadTestsAdventureWorks2008.TypedViewClasses +{ + /// Class which represents a row in the typed view 'UfnGetContactInformationResult'. + public partial class UfnGetContactInformationResultTypedViewRow + { + #region Class Member Declarations + private System.String _businessEntityType; + private System.String _firstName; + private System.String _jobTitle; + private System.String _lastName; + private System.Int32 _personId; + #endregion + + #region Extensibility Method Definitions + partial void OnCreated(); + #endregion + + /// Initializes a new instance of the class. + public UfnGetContactInformationResultTypedViewRow() + { + OnCreated(); + } + + #region Class Property Declarations + /// Gets the BusinessEntityType field. Mapped onto target field / column 'BusinessEntityType'. + public System.String BusinessEntityType + { + get { return _businessEntityType; } + } + + /// Gets the FirstName field. Mapped onto target field / column 'FirstName'. + public System.String FirstName + { + get { return _firstName; } + } + + /// Gets the JobTitle field. Mapped onto target field / column 'JobTitle'. + public System.String JobTitle + { + get { return _jobTitle; } + } + + /// Gets the LastName field. Mapped onto target field / column 'LastName'. + public System.String LastName + { + get { return _lastName; } + } + + /// Gets the PersonId field. Mapped onto target field / column 'PersonID'. + public System.Int32 PersonId + { + get { return _personId; } + } + + #endregion + } +} +#pragma warning restore 0649 diff --git a/tests/AdventureWorks2008Model/packages.config b/tests/AdventureWorks2008Model/packages.config new file mode 100644 index 0000000..c165d43 --- /dev/null +++ b/tests/AdventureWorks2008Model/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/LinqToSql2Tests.sln b/tests/LinqToSql2Tests.sln new file mode 100644 index 0000000..acedbdf --- /dev/null +++ b/tests/LinqToSql2Tests.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadTests", "ReadTestsAdventureWorks2008\ReadTests.csproj", "{9F6F9876-C1B1-4AB4-9B0B-3142A7F83913}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdventureWorks2008", "AdventureWorks2008Model\AdventureWorks2008.csproj", "{26A446B2-7479-4DCB-A13B-C2A97F128A36}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9F6F9876-C1B1-4AB4-9B0B-3142A7F83913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F6F9876-C1B1-4AB4-9B0B-3142A7F83913}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F6F9876-C1B1-4AB4-9B0B-3142A7F83913}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F6F9876-C1B1-4AB4-9B0B-3142A7F83913}.Release|Any CPU.Build.0 = Release|Any CPU + {26A446B2-7479-4DCB-A13B-C2A97F128A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26A446B2-7479-4DCB-A13B-C2A97F128A36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26A446B2-7479-4DCB-A13B-C2A97F128A36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26A446B2-7479-4DCB-A13B-C2A97F128A36}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/ReadTestsAdventureWorks2008/AdventureWorksTests.cs b/tests/ReadTestsAdventureWorks2008/AdventureWorksTests.cs new file mode 100644 index 0000000..7e2941d --- /dev/null +++ b/tests/ReadTestsAdventureWorks2008/AdventureWorksTests.cs @@ -0,0 +1,1027 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework; + +using System.Data.Linq; +using ReadTestsAdventureWorks2008; +using ReadTestsAdventureWorks2008.EntityClasses; +using ReadTestsAdventureWorks2008.TypedViewClasses; +using System.Data.Linq.Mapping; + +using SD.Tools.OrmProfiler.Interceptor; +using System.Data.Common; +using System.Configuration; + +namespace ReadTestsAdventureWorks2008 +{ + /// + /// Selection of tests ported from the LLBLGen Pro runtime framework Linq test library. As Linq to Sql doesn't support TPE inheritance, some tests aren't + /// that useful, but we've left them here as they can't hurt. + /// + [TestFixture] + public class AdventureWorksTests + { + #region Members + private MappingSource _mappingSourceFromXmlFile; + #endregion + + + [TestFixtureSetUp] + public void SetupTests() + { + InterceptorCore.Initialize("AdventureWorksTests"); + } + + + [Test] + public void AnyOnSubtypeWithContainsAndWhere() + { + using(var ctx = GetContext()) + { + var ids = new[] { 43659, 43660, 43661}; + var q = (from c in ctx.Customers + from soh in c.SalesOrderHeaders + where ids.Contains(soh.SalesOrderId) + select c).Where(x => x.SalesTerritory.CountryRegionCode == "US").Any(); + + Assert.IsTrue(q); + } + } + + [Test] + public void AnyOnSubtypeWithContainsAndWhere2() + { + using(var ctx = GetContext()) + { + var ids = new[] { 43659, 43660, 43661 }; + var q = (from c in ctx.Customers + from soh in c.SalesOrderHeaders + where ids.Contains(soh.SalesOrderId) + select c); + var q2 = (from x in q + join st in ctx.SalesTerritories on x.TerritoryId equals st.TerritoryId into jst + from y in jst.DefaultIfEmpty() + where y.CountryRegionCode == "US" + select x).Any(); + + var v = q2; + + Assert.IsTrue(v); + } + } + + + [Test] + public void GroupByWithHopTest() + { + using(var ctx = GetContext()) + { + var q = ctx.SalesOrderDetails + .Where(srr => srr.SalesOrderHeader.CustomerId == 14120 + && srr.SalesOrderHeader.ShipDate != null) + .GroupBy(srr => new { srr.SalesOrderId, srr.SalesOrderHeader.ShipMethodId, srr.SalesOrderHeader.ShipDate }) + .Select(x => new + { + Date = x.Key.ShipDate, + ShipMethodId = x.Key.ShipMethodId, + Value = x.Average(z => (decimal)z.OrderQty) + }); + + var results = q.ToList(); + Assert.AreEqual(2, results.Count); + foreach(var v in results) + { + Assert.AreEqual(1.0, v.Value); + Assert.AreEqual(1, v.ShipMethodId); + } + } + } + + + [Test] + public void AnyOverWhere() + { + using(var ctx = GetContext()) + { + bool exists = ctx.Customers.Where(c => c.CustomerId == 15758).Any(); + Assert.IsTrue(exists); + } + } + + [Test] + [Ignore("Spatial isn't supported, see #11")] + public void FetchAddressWithGeographyField() + { + using(var ctx = GetContext()) + { + var q = from a in ctx.Addresses + where a.Id == 3 + select a; + + Assert.AreEqual(1, q.Count()); + } + } + + + [Test] + public void FetchEntityWithRenamedPkField() + { + using(var ctx = GetContext()) + { + var q = from a in ctx.AddressTypes + where a.Id == 3 + select a; + + Assert.AreEqual(1, q.Count()); + } + } + + + [Test] + public void NullExceptionWithMissingOrderByTest() + { + using(var ctx = GetContext()) + { + var q = (from soh in ctx.SalesOrderHeaders + where soh.SalesOrderId < 43690 + from sod in soh.SalesOrderDetails + orderby soh.SalesOrderId + select new { + soh.SalesOrderId, + ctx.Products.First(p => p.ProductId == sod.ProductId).Name, + sod.SalesOrderDetailId, + }); + var results = q.ToList(); + Assert.AreEqual(289, results.Count); + } + } + + + + /// + /// Test should produce data obtained with 2 left joins, where 1 is a leftjoin forced by the left join of the relation it is joined to (instead of an + /// inner join) + /// + [Test] + public void FetchProjectionWithRelatedDataOverTwoManyToOneHops() + { + using(var ctx = GetContext()) + { + var q = from p in ctx.Products + orderby p.ProductId ascending + select new + { + p.ProductId, + p.Name, + CategoryName = p.ProductSubcategory.ProductCategory.Name + }; + + int count = 0; + foreach(var v in q) + { + count++; + } + + Assert.AreEqual(504, count); + } + } + + + [Test] + public void DefaultIfEmptyOnRelatedEntity() + { + using(var ctx = GetContext()) + { + var q = from customer in ctx.Customers + from soh in customer.SalesOrderHeaders.DefaultIfEmpty() + where soh.SalesOrderId == null + select customer; + int count = 0; + foreach(var v in q) + { + count++; + } + Assert.AreEqual(701, count); + } + } + + + [Test] + public void DefaultIfEmptyOnRelatedEntityWithMultipleHops() + { + using(var ctx = GetContext()) + { + var q = from customer in ctx.Customers + from soh in customer.SalesOrderHeaders.DefaultIfEmpty() + where soh.SalesOrderId == null + select customer; + + int count = 0; + foreach(var v in q) + { + count++; + } + Assert.AreEqual(701, count); + } + } + + + /// + /// Tests if a misplaced where still leads to a proper query. + /// + [Test] + public void DefaultIfEmptyOnRelatedEntityWithMultipleHops4() + { + using(var ctx = GetContext()) + { + var q = from customer in ctx.Customers + from soh in customer.SalesOrderHeaders + where soh.Comment != null + from sod in soh.SalesOrderDetails + where sod.CarrierTrackingNumber!=null + select customer; + + int count = 0; + foreach(var v in q) + { + count++; + } + Assert.AreEqual(0, count); + } + } + + + [Test] + public void WhereInNestedFromCombinedWithDefaultIfEmpty() + { + using(var ctx = GetContext()) + { + var q = from customer in ctx.Customers + where (customer.CustomerId > 10000 && customer.CustomerId < 12000) + from soh in customer.SalesOrderHeaders.DefaultIfEmpty() + select new { customer.CustomerId, soh.SalesOrderId }; + + int count = 0; + foreach(var v in q) + { + count++; + } + Assert.AreEqual(2975, count); + } + } + + /* + [Test] + public void CustomProjectionIntoAnonymousTypeOnSelectManyList() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q1 = from soh in ctx.SalesOrderHeader + from sod in soh.SalesOrderDetailCollection + select soh; + var q = (from soh in q1 + select new { soh.SalesOrderId }).Distinct(); + + int count = 0; + foreach(var v in q) + { + count++; + Assert.IsTrue(v.SalesOrderId > 0); + } + Assert.AreEqual(31465, count); + } + } + + + [Test] + public void CustomProjectionIntoAnonymousTypeUsingMultipleQueries() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + //var customers = ctx.Customer.AsQueryable(); + //var customersDerivedTable = customers.Where(c => c.CustomerId <100); + //var q1 = from customer in customersDerivedTable + var q1 = from customer in ctx.Customer + where customer.CustomerId<100 + from soh in customer.SalesOrderHeaderCollection.DefaultIfEmpty() + select new { customer.CustomerId, soh.SalesOrderId }; + var z = q1.ToList(); + + int count = 0; + foreach(var v in z) + { + count++; + } + Assert.AreEqual(586, count); + } + } + + [Test] + public void CustomProjectionIntoAnonymousTypeUsingDefaultIfEmptyOnNestedFromsWithEmbeddedWhere() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable(); + var q = from c in customers + from soh in c.SalesOrderHeaderCollection.Where(soh => soh.SalesOrderId < 10).DefaultIfEmpty() + select new { c.CustomerId, soh.SalesOrderId }; + + foreach(var v in q) + { + } + } + } + + + /// + /// Just for query construction tests that the queries don't crash + /// + [Test] + public void MiscellaneousTests1() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var query = from soh in ctx.SalesOrderHeader select soh; + + var w = (from soh in query + from sod in soh.SalesOrderDetailCollection + select new { soh.SalesOrderId, soh.Customer.AccountNumber, soh.CreditCard.CardNumber }).ToList(); + + query = from soh in ctx.SalesOrderHeader + from sod in soh.SalesOrderDetailCollection + select soh; + //SQL error + + var y = (from soh in query + select new { soh.SalesOrderId }).ToList(); + + //Bad alias? error + + var sohquery = from soh in ctx.SalesOrderHeader select soh; + + var w2 = (from soh in sohquery + from sod in soh.SalesOrderDetailCollection + select new { soh.SalesOrderId, soh.Customer.AccountNumber, soh.CreditCard.CardNumber }).ToList(); + + // query = query.Where(soh => soh.Customer.CustomerAddress.Any(ca => ca.Address.StateProvince.Name == state)); + + query = from soh in query + where soh.Customer.CustomerAddressCollection.Any(ca => ca.Address.StateProvince.Name == "Arizona") + select soh; + + //query = query.Where(soh => soh.Customer.CustomerAddress.Any(ca => ca.Address.City == cityName)); + + query = from soh in query + where soh.Customer.CustomerAddressCollection.Any(ca => ca.Address.City == "Houston") + select soh; + + List countries = new List() { "Argentina", "Brazil"}; + query = from soh in query + where soh.Customer.CustomerAddressCollection.Any(ca => countries.Contains(ca.Address.StateProvince.CountryRegion.Name)) + select soh; + + var sohShipMethod = from soh in query + select new { soh.SalesOrderId, soh.CreditCard.CardNumber }; + + sohShipMethod = sohShipMethod.Take(3); + + foreach(var v in sohShipMethod) + { + } + } + } + + + /// + /// Just for query construction tests that the queries don't crash + /// + [Test] + public void MiscellaneousTests2() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable(); + + var customersDerivedTable = customers.Where(c => c.CustomerId > 10); //To force a derived table + + // var q = AWHelper.ctx.Customer.SelectMany(customer => customer.CustomerAddress, (customer, ca) => new {customer, ca}).GroupJoin(AWHelper.ctx.SalesOrderHeader, @t => @t.customer.CustomerId, soh => soh.CustomerId, (@t, oc) => new {@t, oc}).SelectMany(@t => @t.oc.DefaultIfEmpty(), (@t, nullableSOH) => new {@t.@t.customer.CustomerId, @t.@t.ca.AddressId, nullableSOH.SalesOrderId}); + + var q = from customer in customersDerivedTable + from ca in customer.CustomerAddressCollection + join soh in ctx.SalesOrderHeader on customer.CustomerId equals soh.CustomerId into oc + from nullableSOH in oc.DefaultIfEmpty() + select new { customer.CustomerId, ca.AddressId, nullableSOH.SalesOrderId }; + q = q.Take(10); + + var ql = q.ToList(); + Assert.AreEqual(10, ql.Count); + + var q1 = from customer in customersDerivedTable + from soh in customer.SalesOrderHeaderCollection.DefaultIfEmpty() + select new { customer.CustomerId, soh.SalesOrderId }; + q1 = q1.Take(10); + var z = q1.ToList(); + + Assert.AreEqual(10, z.Count); + + var q2 = from customer in customersDerivedTable + from ca in customer.CustomerAddressCollection + // from soh in customer.SalesOrderHeader.DefaultIfEmpty() + select new { customer.CustomerId, customer.SalesTerritory.Name }; + q2 = q2.Take(10); + var w = q2.ToList(); + Assert.AreEqual(10, w.Count); + + var q3 = from customer in customersDerivedTable + from ca in customer.CustomerAddressCollection + from soh in customer.SalesOrderHeaderCollection + select new { customer.CustomerId, ca.AddressId, soh.SalesOrderId }; + q3 = q3.Take(10); + var k = q3.ToList(); + Assert.AreEqual(10, k.Count); + + var q5 = from customer in customersDerivedTable + from ca in customer.CustomerAddressCollection + from soh in customer.SalesOrderHeaderCollection.DefaultIfEmpty() + select new { customer.CustomerId, ca.AddressId, soh.SalesOrderId }; + q5 = q5.Take(10); + var f = q5.ToList(); + Assert.AreEqual(10, f.Count); + + var q4 = from customer in customers + from soh in customer.SalesOrderHeaderCollection.Where(soh => soh.SalesOrderId < 10).DefaultIfEmpty() + select new { customer.CustomerId, SalesOrderId = soh.SalesOrderId }; + q4 = q4.Take(10); + var x = q4.ToList(); + foreach(var v in x) + { + Assert.AreEqual(0, v.SalesOrderId); + } + Assert.AreEqual(10, x.Count); + } + } + + + /// + /// Just for query construction tests that the queries don't crash + /// + [Test] + public void MiscellaneousTests3() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from soh in ctx.SalesOrderHeader + from sod in soh.SalesOrderDetailCollection + select soh; + + var x = (from soh in q + select new { soh.SalesOrderId, soh.Customer.AccountNumber }).ToList(); + + } + } + + + /// + /// Just for query construction tests that the queries don't crash + /// + [Test] + public void MiscellaneousTests4() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from soh in ctx.SalesOrderHeader + from sod in soh.SalesOrderDetailCollection + select soh; + + var x = (from soh in q + select new { soh.SalesOrderId, soh.Customer.AccountNumber, soh.CreditCard.CardNumber }).ToList(); + + } + } + + [Test] + public void MiscellaneousTests5() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var sohquery = from soh in ctx.SalesOrderHeader select soh; + + var w = (from soh in sohquery + from sod in soh.SalesOrderDetailCollection + select new { soh.SalesOrderId, soh.Customer.AccountNumber, soh.CreditCard.CardNumber }).ToList(); + + } + } + + [Test] + public void MiscellaneousTests6() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable(); + var customersDerivedTable = from customer in customers select customer; //Using this to force a derived table causes a crash + customersDerivedTable = customers.Where(c => c.CustomerId > 10); //To force a derived table + + var q = from customer in customersDerivedTable + join soh in + (from s in ctx.SalesOrderHeader where s.SalesPersonId > 22 select s) on customer.CustomerId equals soh.CustomerId into oc + from nullableSOH in oc.DefaultIfEmpty() + + from ca in customer.CustomerAddressCollection.DefaultIfEmpty() + select new { customer.CustomerId, ca.AddressId, nullableSOH.SalesOrderId, customer.SalesTerritory.Name }; + q = q.Take(10); + + var l = q.ToList(); + } + } + + [Test] + public void MiscellaneousTests7() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable(); + var q = from customer in customers + join soh in + (from s in ctx.SalesOrderHeader where s.SalesPersonId > 22 select s) on customer.CustomerId equals soh.CustomerId into join1 + join ca in + (from custaddr in ctx.CustomerAddress where custaddr.AddressId > 100 select custaddr) + on customer.CustomerId equals ca.CustomerId into join2 + from xca in join2.DefaultIfEmpty() + from xsoh in join1.DefaultIfEmpty() + select new { customer.CustomerId, xca.AddressId, xsoh.SalesOrderId, customer.SalesTerritory.Name }; + q = q.Take(10); + + var l = q.ToList(); + } + } + + + [Test] + public void MiscellaneousTests8() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable(); + var q = from customer in customers + join ca in + (from custaddr in ctx.CustomerAddress where custaddr.AddressId > 100 select custaddr) + on customer.CustomerId equals ca.CustomerId into join2 + from xca in join2.DefaultIfEmpty() + join soh in + (from s in ctx.SalesOrderHeader where s.SalesPersonId > 22 select s) on customer.CustomerId equals soh.CustomerId into join1 + from xsoh in join1.DefaultIfEmpty() + select new { customer.CustomerId, xca.AddressId, xsoh.SalesOrderId, customer.SalesTerritory.Name }; + q = q.Take(10); + + var l = q.ToList(); + } + } + + + [Test] + public void MiscellaneousTests9() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var customers = ctx.Customer.AsQueryable().Select(c=>c); + customers = customers.Where(c => c.CustomerId > 10); + var q = from c in customers + from soh in c.SalesOrderHeaderCollection + select new + { + Scalar = (from a in ctx.Address + from ca in a.CustomerAddressCollection + where ca.CustomerId == c.CustomerId + select a).Count() + }; + + foreach(var v in q) + { + } + + } + } + + + [Test] + public void MiscellaneousTests10() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from ca in ctx.CustomerAddress + where ca.Address.PostalCode == "98011" + group ca by ca.Address.StateProvince.CountryRegion.Name into g + select new { g.Key, Amount = g.Count() }; + + foreach(var v in q) + { + } + } + } + + + [Test] + public void MiscellaneousTests11() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from Address in ctx.Address + from EmployeeAddress in Address.EmployeeAddressCollection + from Individual in EmployeeAddress.Employee.Contact.IndividualCollection + select Address; + + foreach(var v in q) + { + } + } + } + + + [Test] + public void MiscellaneousTests12() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from Address in ctx.Address + from EmployeeAddress in Address.EmployeeAddressCollection + select EmployeeAddress.Employee.Contact; + + foreach(var v in q) + { + } + } + } + + + [Test] + public void MiscellaneousTests13() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = ctx.CustomerAddress.Select(ca => ca.Address.StateProvince.CountryRegion); + foreach(var v in q) + { + } + } + } + + + [Test] + [Ignore("Crashes with null-ref. Possibly due to the multi-hop in the on clause. Likely related to other ignored tests")] + public void MiscellaneousTests14() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from address in ctx.Address + join employeeAddress in ctx.EmployeeAddress on address.Id equals employeeAddress.AddressId + join individual in ctx.Individual on employeeAddress.Employee.Contact.ContactId equals individual.ContactId + select address; + + foreach(var v in q) + { + } + } + } + + + [Test] + [Ignore("Crashes with re-aliasing due to inheritance. GEM:760")] + public void MiscellaneousTests15() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from c in ctx.Contact + where c.EmployeeCollection.Any(e=>e.EmployeeAddressCollection.Count()>0) + select c.IndividualCollection; + + foreach(var v in q) + { + } + } + } + + + [Test] + [Ignore("Crashes with nested query issue due to the wrong parent query is produced. GEM:761")] + public void MiscellaneousTests16() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = ctx.EmployeeAddress.Select(e => e.Employee.Contact.IndividualCollection); + + foreach(var v in q) + { + } + } + } + + + [Test] + public void MiscellaneousTests17() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = from soh in ctx.SalesOrderHeader + from sod in soh.SalesOrderDetailCollection + from sod2 in soh.SalesOrderDetailCollection + where sod.SalesOrderId > 10 && sod2.SalesOrderId > 1 + select soh; + + var w = (from soh in q + from sod3 in soh.SalesOrderDetailCollection + select soh).ToList(); //crash + } + } + + + [Test] + public void MiscellaneousTests18() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var c = from Address in ctx.Address + from EmployeeAddress in Address.EmployeeAddressCollection + select Address; + + var q = from Address in c + from EmployeeAddress in Address.EmployeeAddressCollection + from SalesOrderHeader in Address.SalesOrderHeaderCollection.DefaultIfEmpty() + select Address; + + foreach(var v in q) + { + } + } + } + + + [Test] + public void PrefetchPathTestUsingInheritanceAndSubqueries() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + adapter.ParameterisedPrefetchPathThreshold = 1; + var q = (from s in ctx.SalesPerson + select s).WithPath( + new PathEdge(SalesPersonEntity.PrefetchPathSalesTerritory) + ); + + int count = 0; + foreach(var v in q) + { + count++; + if(new[] { 268, 284, 288 }.Contains(v.EmployeeId)) + { + Assert.IsNull(v.SalesTerritory); + } + else + { + Assert.IsNotNull(v.SalesTerritory); + } + } + Assert.AreEqual(17, count); + } + } + + + [Test] + public void DoubleAndDecimalMathCalculationsWithLet() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter, new AdventureWorksFunctionMappings()); + const double EarthRadius = 3963.1; + var q = from address in ctx.CreativeAddress + //let lat1 = (double)address.Latitude.Value * Math.PI / 180 + //let lon1 = (double)address.Longitude.Value * Math.PI / 180 + let lat1 = address.LatitudeF.Value * Math.PI / 180 + let lon1 = address.LongitudeF.Value * Math.PI / 180 + let x2 = AdventureWorksFunctions.Sin(lat1) * + AdventureWorksFunctions.Cos(lat1) + let d = EarthRadius * (-1 * AdventureWorksFunctions.Atan(x2 / AdventureWorksFunctions.Sqrt(1 - x2 * x2)) + Math.PI / 2) + where address.Latitude.HasValue && address.Longitude.HasValue + select d; + + foreach(var d in q) + { + Assert.AreEqual(5524.3839485018443, d); + } + } + } + + + [Test] + public void ContainsWithMultipleValuePairsAndWrappedQueriesTest() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q1 = ctx.WorkOrderRouting.AsQueryable(); + + var lst = new List>(); + lst.Add(new Pair { Value1 = 1, Value2 = 722 }); + lst.Add(new Pair { Value1 = 2, Value2 = 725 }); + lst.Add(new Pair { Value1 = 3, Value2 = 726 }); + + q1 = q1.Where( + p => lst.Contains( + new Pair + { + Value1 = p.WorkOrder.WorkOrderId, + Value2 = p.WorkOrder.ProductId + } + ) + ); + + + var q = q1.Select( + p => new + { + p.ProductId, + p.WorkOrder.WorkOrderId + }).ToList(); + + foreach(var v in q) + { + + } + } + } + + + + [Test] + public void ProjectionToCustomClassUsingNullableValueThroughScalarQueryTest() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = (from p in ctx.WorkOrder + select new BusinessObject() + { + ProductId = p.ProductId, + ModifiedDate = p.WorkOrderRoutingCollection.Max(x => x.ModifiedDate) + + }); + + int count = 0; + foreach(var v in q) + { + if(!v.ModifiedDate.HasValue) + { + count++; + } + } + + Assert.IsTrue(count>0); + } + } + + + [Test] + public void FetchingSecondPageUsingOutOfOrderSkipTake() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var q = ctx.Contact.Take(10).Skip(10); + int count = 0; + + foreach(var v in q) + { + count++; + } + Assert.AreEqual(10, count); + } + } + + + [Test] + public void CompareToOnGuidTest() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter, new AdventureWorksGuidFunctionMappings()); + var q = (from a in ctx.Address select a) + .Where(a => a.Rowguid.CompareTo(new Guid("57f73b00-26b1-11df-8600-001c2311de1b")) < 0); + + int count = 0; + foreach(var v in q) + { + count++; + } + Assert.AreEqual(6, count); + } + } + + + [Test] + public void MultipleTimesSameJoinSameAliasProblem() + { + using(var ctx = GetContext()) + { + LinqMetaData metaData = new LinqMetaData(adapter); + var pQuery = ctx.Product.AsQueryable(); + var sQuery = ctx.ProductSubcategory.AsQueryable(); + pQuery = pQuery.Where(x => x.ProductId != 0); //example code + var q1 = from p in pQuery + join sc in sQuery on p.ProductSubcategoryId equals sc.ProductSubcategoryId + //let temp = sc uncomment this to workaround the exception + select p; + + var pList = (from sc in ctx.ProductSubcategory + join p in q1 on sc.ProductSubcategoryId equals p.ProductSubcategoryId + select new + { + Value1 = p.ProductId, + Value2 = sc.ProductCategoryId, + }).ToList(); + + foreach(var v in q1) + { + + } + } + } + + #region Failing tests + [Test] + [Ignore("Fails, see LLBLMAIN-1159")] + public void AnyOnSubtypeWithContainsAndWhere3() + { + using(var ctx = GetContext()) + { + var metaData = new LinqMetaData(adapter); + + var ids = new[] { 43659, 43660, 43661 }; + var q = (from c in ctx.Customer + from soh in c.SalesOrderHeaderCollection + where ids.Contains(soh.SalesOrderId) + select c).Any(x => x.SalesTerritory.CountryRegionCode == "US"); + + Assert.IsTrue(q); + } + } + #endregion + */ + + private AdventureWorks2008DataContext GetContext() + { + if(_mappingSourceFromXmlFile == null) + { + var modelAssembly = typeof(AdventureWorks2008DataContext).Assembly; + var resourceStream = modelAssembly.GetManifestResourceStream("AdventureWorks2008.AdventureWorks2008Mappings.xml"); + _mappingSourceFromXmlFile = XmlMappingSource.FromStream(resourceStream); + } + // pass in sql connection to make sure the profiler gathers the right information + var factory = DbProviderFactories.GetFactory("System.Data.SqlClient"); + var connection = factory.CreateConnection(); + connection.ConnectionString = ConfigurationManager.ConnectionStrings["AdventureWorksConnectionString.SQL Server (SqlClient)"].ConnectionString; + return new AdventureWorks2008DataContext(connection, _mappingSourceFromXmlFile); + } + + + } + + + //internal class AdventureWorksGuidFunctionMappings : FunctionMappingStore + //{ + // public AdventureWorksGuidFunctionMappings() + // : base() + // { + // this.Add(new FunctionMapping(typeof(Guid), "CompareTo", 1, "CASE WHEN {0} < {1} THEN -1 WHEN {0} = {1} THEN 0 ELSE 1 END")); + // } + //} + + + internal class BusinessObject + { + public int ProductId { get; set; } + public DateTime? ModifiedDate { get; set; } + } +} diff --git a/tests/ReadTestsAdventureWorks2008/App.config b/tests/ReadTestsAdventureWorks2008/App.config new file mode 100644 index 0000000..cb3dbc1 --- /dev/null +++ b/tests/ReadTestsAdventureWorks2008/App.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/ReadTestsAdventureWorks2008/Properties/AssemblyInfo.cs b/tests/ReadTestsAdventureWorks2008/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f56283a --- /dev/null +++ b/tests/ReadTestsAdventureWorks2008/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ReadTestsAdventureWorks2008")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ReadTestsAdventureWorks2008")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8d34e233-2375-44a8-9523-1676bf89187b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/ReadTestsAdventureWorks2008/ReadTests.csproj b/tests/ReadTestsAdventureWorks2008/ReadTests.csproj new file mode 100644 index 0000000..4d57f06 --- /dev/null +++ b/tests/ReadTestsAdventureWorks2008/ReadTests.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {9F6F9876-C1B1-4AB4-9B0B-3142A7F83913} + Library + Properties + ReadTestsAdventureWorks2008 + ReadTestsAdventureWorks2008 + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + ..\..\src\bin\Debug\SD.Tools.LinqToSQL2.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\Solutions Design\ORM Profiler v1.5\SD.Tools.OrmProfiler.Interceptor.NET45.dll + + + + + + + + + + + + + + + + + + + + + {26a446b2-7479-4dcb-a13b-c2a97f128a36} + AdventureWorks2008 + + + + + \ No newline at end of file diff --git a/tests/ReadTestsAdventureWorks2008/packages.config b/tests/ReadTestsAdventureWorks2008/packages.config new file mode 100644 index 0000000..c714ef3 --- /dev/null +++ b/tests/ReadTestsAdventureWorks2008/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/SourceProjects/AdventureWorks2008.llblgenproj b/tests/SourceProjects/AdventureWorks2008.llblgenproj new file mode 100644 index 0000000..b078798 --- /dev/null +++ b/tests/SourceProjects/AdventureWorks2008.llblgenproj @@ -0,0 +1,6431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file