/// <summary> /// Fill a TList<TestIssue117Tablea> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<TestIssue117Tablea>"/></returns> public static TList <TestIssue117Tablea> Fill(IDataReader reader, TList <TestIssue117Tablea> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.TestIssue117Tablea c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("TestIssue117Tablea") .Append("|").Append((System.Int32)reader[((int)TestIssue117TableaColumn.TestIssue117TableAid - 1)]).ToString(); c = EntityManager.LocateOrCreate <TestIssue117Tablea>( key.ToString(), // EntityTrackingKey "TestIssue117Tablea", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.TestIssue117Tablea(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.TestIssue117TableAid = (System.Int32)reader[((int)TestIssue117TableaColumn.TestIssue117TableAid - 1)]; c.DumbField = (reader.IsDBNull(((int)TestIssue117TableaColumn.DumbField - 1)))?null:(System.Boolean?)reader[((int)TestIssue117TableaColumn.DumbField - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<ShoppingCartItem> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<ShoppingCartItem>"/></returns> public static TList <ShoppingCartItem> Fill(IDataReader reader, TList <ShoppingCartItem> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.ShoppingCartItem c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("ShoppingCartItem") .Append("|").Append((System.Int32)reader[((int)ShoppingCartItemColumn.ShoppingCartItemId - 1)]).ToString(); c = EntityManager.LocateOrCreate <ShoppingCartItem>( key.ToString(), // EntityTrackingKey "ShoppingCartItem", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.ShoppingCartItem(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.ShoppingCartItemId = (System.Int32)reader[((int)ShoppingCartItemColumn.ShoppingCartItemId - 1)]; c.ShoppingCartId = (System.String)reader[((int)ShoppingCartItemColumn.ShoppingCartId - 1)]; c.Quantity = (System.Int32)reader[((int)ShoppingCartItemColumn.Quantity - 1)]; c.ProductId = (System.Int32)reader[((int)ShoppingCartItemColumn.ProductId - 1)]; c.DateCreated = (System.DateTime)reader[((int)ShoppingCartItemColumn.DateCreated - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)ShoppingCartItemColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<SpecialOffer> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<SpecialOffer>"/></returns> public static TList <SpecialOffer> Fill(IDataReader reader, TList <SpecialOffer> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.SpecialOffer c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("SpecialOffer") .Append("|").Append((System.Int32)reader[((int)SpecialOfferColumn.SpecialOfferId - 1)]).ToString(); c = EntityManager.LocateOrCreate <SpecialOffer>( key.ToString(), // EntityTrackingKey "SpecialOffer", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.SpecialOffer(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.SpecialOfferId = (System.Int32)reader[((int)SpecialOfferColumn.SpecialOfferId - 1)]; c.Description = (System.String)reader[((int)SpecialOfferColumn.Description - 1)]; c.DiscountPct = (System.Decimal)reader[((int)SpecialOfferColumn.DiscountPct - 1)]; c.Type = (System.String)reader[((int)SpecialOfferColumn.Type - 1)]; c.Category = (System.String)reader[((int)SpecialOfferColumn.Category - 1)]; c.StartDate = (System.DateTime)reader[((int)SpecialOfferColumn.StartDate - 1)]; c.EndDate = (System.DateTime)reader[((int)SpecialOfferColumn.EndDate - 1)]; c.MinQty = (System.Int32)reader[((int)SpecialOfferColumn.MinQty - 1)]; c.MaxQty = (reader.IsDBNull(((int)SpecialOfferColumn.MaxQty - 1)))?null:(System.Int32?)reader[((int)SpecialOfferColumn.MaxQty - 1)]; c.Rowguid = (System.Guid)reader[((int)SpecialOfferColumn.Rowguid - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)SpecialOfferColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<Document> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<Document>"/></returns> public static TList <Document> Fill(IDataReader reader, TList <Document> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.Document c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("Document") .Append("|").Append((System.Int32)reader[((int)DocumentColumn.DocumentId - 1)]).ToString(); c = EntityManager.LocateOrCreate <Document>( key.ToString(), // EntityTrackingKey "Document", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.Document(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.DocumentId = (System.Int32)reader[((int)DocumentColumn.DocumentId - 1)]; c.Title = (System.String)reader[((int)DocumentColumn.Title - 1)]; c.FileName = (System.String)reader[((int)DocumentColumn.FileName - 1)]; c.FileExtension = (System.String)reader[((int)DocumentColumn.FileExtension - 1)]; c.Revision = (System.String)reader[((int)DocumentColumn.Revision - 1)]; c.ChangeNumber = (System.Int32)reader[((int)DocumentColumn.ChangeNumber - 1)]; c.Status = (System.Byte)reader[((int)DocumentColumn.Status - 1)]; c.DocumentSummary = (reader.IsDBNull(((int)DocumentColumn.DocumentSummary - 1)))?null:(System.String)reader[((int)DocumentColumn.DocumentSummary - 1)]; c.Document = (reader.IsDBNull(((int)DocumentColumn.Document - 1)))?null:(System.Byte[])reader[((int)DocumentColumn.Document - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)DocumentColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<PurchaseOrderHeader> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<PurchaseOrderHeader>"/></returns> public static TList <PurchaseOrderHeader> Fill(IDataReader reader, TList <PurchaseOrderHeader> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.PurchaseOrderHeader c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("PurchaseOrderHeader") .Append("|").Append((System.Int32)reader[((int)PurchaseOrderHeaderColumn.PurchaseOrderId - 1)]).ToString(); c = EntityManager.LocateOrCreate <PurchaseOrderHeader>( key.ToString(), // EntityTrackingKey "PurchaseOrderHeader", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.PurchaseOrderHeader(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.PurchaseOrderId = (System.Int32)reader[((int)PurchaseOrderHeaderColumn.PurchaseOrderId - 1)]; c.RevisionNumber = (System.Byte)reader[((int)PurchaseOrderHeaderColumn.RevisionNumber - 1)]; c.Status = (System.Byte)reader[((int)PurchaseOrderHeaderColumn.Status - 1)]; c.EmployeeId = (System.Int32)reader[((int)PurchaseOrderHeaderColumn.EmployeeId - 1)]; c.VendorId = (System.Int32)reader[((int)PurchaseOrderHeaderColumn.VendorId - 1)]; c.ShipMethodId = (System.Int32)reader[((int)PurchaseOrderHeaderColumn.ShipMethodId - 1)]; c.OrderDate = (System.DateTime)reader[((int)PurchaseOrderHeaderColumn.OrderDate - 1)]; c.ShipDate = (reader.IsDBNull(((int)PurchaseOrderHeaderColumn.ShipDate - 1)))?null:(System.DateTime?)reader[((int)PurchaseOrderHeaderColumn.ShipDate - 1)]; c.SubTotal = (System.Decimal)reader[((int)PurchaseOrderHeaderColumn.SubTotal - 1)]; c.TaxAmt = (System.Decimal)reader[((int)PurchaseOrderHeaderColumn.TaxAmt - 1)]; c.Freight = (System.Decimal)reader[((int)PurchaseOrderHeaderColumn.Freight - 1)]; c.TotalDue = (System.Decimal)reader[((int)PurchaseOrderHeaderColumn.TotalDue - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)PurchaseOrderHeaderColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<PurchaseOrderDetail> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<PurchaseOrderDetail>"/></returns> public static TList <PurchaseOrderDetail> Fill(IDataReader reader, TList <PurchaseOrderDetail> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.PurchaseOrderDetail c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("PurchaseOrderDetail") .Append("|").Append((System.Int32)reader[((int)PurchaseOrderDetailColumn.PurchaseOrderId - 1)]) .Append("|").Append((System.Int32)reader[((int)PurchaseOrderDetailColumn.PurchaseOrderDetailId - 1)]).ToString(); c = EntityManager.LocateOrCreate <PurchaseOrderDetail>( key.ToString(), // EntityTrackingKey "PurchaseOrderDetail", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.PurchaseOrderDetail(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.PurchaseOrderId = (System.Int32)reader[((int)PurchaseOrderDetailColumn.PurchaseOrderId - 1)]; c.OriginalPurchaseOrderId = c.PurchaseOrderId; c.PurchaseOrderDetailId = (System.Int32)reader[((int)PurchaseOrderDetailColumn.PurchaseOrderDetailId - 1)]; c.DueDate = (System.DateTime)reader[((int)PurchaseOrderDetailColumn.DueDate - 1)]; c.OrderQty = (System.Int16)reader[((int)PurchaseOrderDetailColumn.OrderQty - 1)]; c.ProductId = (System.Int32)reader[((int)PurchaseOrderDetailColumn.ProductId - 1)]; c.UnitPrice = (System.Decimal)reader[((int)PurchaseOrderDetailColumn.UnitPrice - 1)]; c.LineTotal = (System.Decimal)reader[((int)PurchaseOrderDetailColumn.LineTotal - 1)]; c.ReceivedQty = (System.Decimal)reader[((int)PurchaseOrderDetailColumn.ReceivedQty - 1)]; c.RejectedQty = (System.Decimal)reader[((int)PurchaseOrderDetailColumn.RejectedQty - 1)]; c.StockedQty = (System.Decimal)reader[((int)PurchaseOrderDetailColumn.StockedQty - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)PurchaseOrderDetailColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }
/// <summary> /// Fill a TList<WorkOrderRouting> From a DataReader. /// </summary> /// <param name="reader">Datareader</param> /// <param name="rows">The collection to fill</param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">number of rows.</param> /// <returns>a <see cref="TList<WorkOrderRouting>"/></returns> public static TList <WorkOrderRouting> Fill(IDataReader reader, TList <WorkOrderRouting> rows, int start, int pageLength) { NetTiersProvider currentProvider = DataRepository.Provider; bool useEntityFactory = currentProvider.UseEntityFactory; bool enableEntityTracking = currentProvider.EnableEntityTracking; LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy; Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType; // advance to the starting row for (int i = 0; i < start; i++) { if (!reader.Read()) { return(rows); // not enough rows, just return } } for (int i = 0; i < pageLength; i++) { if (!reader.Read()) { break; // we are done } string key = null; Nettiers.AdventureWorks.Entities.WorkOrderRouting c = null; if (useEntityFactory) { key = new System.Text.StringBuilder("WorkOrderRouting") .Append("|").Append((System.Int32)reader[((int)WorkOrderRoutingColumn.WorkOrderId - 1)]) .Append("|").Append((System.Int32)reader[((int)WorkOrderRoutingColumn.ProductId - 1)]) .Append("|").Append((System.Int16)reader[((int)WorkOrderRoutingColumn.OperationSequence - 1)]).ToString(); c = EntityManager.LocateOrCreate <WorkOrderRouting>( key.ToString(), // EntityTrackingKey "WorkOrderRouting", //Creational Type entityCreationFactoryType, //Factory used to create entity enableEntityTracking); // Track this entity? } else { c = new Nettiers.AdventureWorks.Entities.WorkOrderRouting(); } if (!enableEntityTracking || c.EntityState == EntityState.Added || (enableEntityTracking && ( (currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) || (currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged) ) )) { c.SuppressEntityEvents = true; c.WorkOrderId = (System.Int32)reader[((int)WorkOrderRoutingColumn.WorkOrderId - 1)]; c.OriginalWorkOrderId = c.WorkOrderId; c.ProductId = (System.Int32)reader[((int)WorkOrderRoutingColumn.ProductId - 1)]; c.OriginalProductId = c.ProductId; c.OperationSequence = (System.Int16)reader[((int)WorkOrderRoutingColumn.OperationSequence - 1)]; c.OriginalOperationSequence = c.OperationSequence; c.LocationId = (System.Int16)reader[((int)WorkOrderRoutingColumn.LocationId - 1)]; c.ScheduledStartDate = (System.DateTime)reader[((int)WorkOrderRoutingColumn.ScheduledStartDate - 1)]; c.ScheduledEndDate = (System.DateTime)reader[((int)WorkOrderRoutingColumn.ScheduledEndDate - 1)]; c.ActualStartDate = (reader.IsDBNull(((int)WorkOrderRoutingColumn.ActualStartDate - 1)))?null:(System.DateTime?)reader[((int)WorkOrderRoutingColumn.ActualStartDate - 1)]; c.ActualEndDate = (reader.IsDBNull(((int)WorkOrderRoutingColumn.ActualEndDate - 1)))?null:(System.DateTime?)reader[((int)WorkOrderRoutingColumn.ActualEndDate - 1)]; c.ActualResourceHrs = (reader.IsDBNull(((int)WorkOrderRoutingColumn.ActualResourceHrs - 1)))?null:(System.Decimal?)reader[((int)WorkOrderRoutingColumn.ActualResourceHrs - 1)]; c.PlannedCost = (System.Decimal)reader[((int)WorkOrderRoutingColumn.PlannedCost - 1)]; c.ActualCost = (reader.IsDBNull(((int)WorkOrderRoutingColumn.ActualCost - 1)))?null:(System.Decimal?)reader[((int)WorkOrderRoutingColumn.ActualCost - 1)]; c.ModifiedDate = (System.DateTime)reader[((int)WorkOrderRoutingColumn.ModifiedDate - 1)]; c.EntityTrackingKey = key; c.AcceptChanges(); c.SuppressEntityEvents = false; } rows.Add(c); } return(rows); }