Skip to content

Instantly share code, notes, and snippets.

@FransBouma
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FransBouma/10393394 to your computer and use it in GitHub Desktop.
Save FransBouma/10393394 to your computer and use it in GitHub Desktop.
LLBLGen Pro typed list generated as poco + query (Linq or QuerySpec) (v4.2)
// Generated linq queries:
/// <summary>Gets the query to fetch the typed list OneToManyPocoLinq</summary>
public IQueryable<Northwind.Adapter.TypedListClasses.OneToManyPocoLinqRow> GetOneToManyPocoLinqTypedList()
{
var current0 = this.Customer;
var current1 = from c in current0
join o in this.Order on c.CustomerId equals o.CustomerId
join od in this.OrderDetails on o.OrderId equals od.OrderId
select new {o, c, od };
return current1.Select(v=>new Northwind.Adapter.TypedListClasses.OneToManyPocoLinqRow() { CustomerId = v.c.CustomerId, CompanyName = v.c.CompanyName, OrderId = v.o.OrderId, OrderDate = v.o.OrderDate, Discount = v.od.Discount, ProductId = v.od.ProductId, Quantity = v.od.Quantity });
}
/// <summary>Gets the query to fetch the typed list OrderDetailsPocoWithLinq</summary>
public IQueryable<Northwind.Adapter.TypedListClasses.OrderDetailsPocoWithLinqRow> GetOrderDetailsPocoWithLinqTypedList()
{
var current0 = this.OrderDetails;
var current1 = from orderDetails in current0
join order in this.Order on orderDetails.OrderId equals order.OrderId
join product in this.Product on orderDetails.ProductId equals product.ProductId
join customer in this.Customer on order.CustomerId equals customer.CustomerId
join shipper in this.Shipper on order.ShipVia equals shipper.ShipperId
join category in this.Category on product.CategoryId equals category.Id
join supplier in this.Supplier on product.SupplierId equals supplier.Id
select new {order, orderDetails, product, customer, shipper, category, supplier };
return current1.Select(v=>new Northwind.Adapter.TypedListClasses.OrderDetailsPocoWithLinqRow() { CompanyName = v.customer.CompanyName, OrderId = v.order.OrderId, OrderDate = v.order.OrderDate, Discount = v.orderDetails.Discount, Quantity = v.orderDetails.Quantity, UnitPrice = v.orderDetails.UnitPrice, ProductName = v.product.ProductName, CategoryName = v.category.CategoryName, SupplierName = v.supplier.CompanyName, ShipperName = v.shipper.CompanyName });
}
// Generated QuerySpec queries:
/// <summary>Gets the query to fetch the typed list OneToManyPocoQs</summary>
public DynamicQuery<Northwind.Adapter.TypedListClasses.OneToManyPocoQsRow> GetOneToManyPocoQsTypedList()
{
return this.Create()
.Select(() => new Northwind.Adapter.TypedListClasses.OneToManyPocoQsRow()
{
CustomerId = CustomerFields.CustomerId.Source("C").ToValue<System.String>(),
CompanyName = CustomerFields.CompanyName.Source("C").ToValue<System.String>(),
OrderId = OrderFields.OrderId.Source("O").ToValue<System.Int32>(),
OrderDate = OrderFields.OrderDate.Source("O").ToValue<Nullable<System.DateTime>>(),
Discount = OrderDetailsFields.Discount.Source("Od").ToValue<System.Single>(),
ProductId = OrderDetailsFields.ProductId.Source("Od").ToValue<System.Int32>(),
Quantity = OrderDetailsFields.Quantity.Source("Od").ToValue<System.Int16>()
})
.From(this.Customer
.InnerJoin(this.Order.As("O")).On(CustomerFields.CustomerId.Source("C").Equal(OrderFields.CustomerId.Source("O")))
.InnerJoin(this.OrderDetails.As("Od")).On(OrderFields.OrderId.Source("O").Equal(OrderDetailsFields.OrderId.Source("Od"))));
}
/// <summary>Gets the query to fetch the typed list OrderDetailsPocoWithQs</summary>
public DynamicQuery<Northwind.Adapter.TypedListClasses.OrderDetailsPocoWithQsRow> GetOrderDetailsPocoWithQsTypedList()
{
return this.Create()
.Select(() => new Northwind.Adapter.TypedListClasses.OrderDetailsPocoWithQsRow()
{
CompanyName = CustomerFields.CompanyName.ToValue<System.String>(),
OrderId = OrderFields.OrderId.ToValue<System.Int32>(),
OrderDate = OrderFields.OrderDate.ToValue<Nullable<System.DateTime>>(),
Discount = OrderDetailsFields.Discount.ToValue<System.Single>(),
Quantity = OrderDetailsFields.Quantity.ToValue<System.Int16>(),
UnitPrice = OrderDetailsFields.UnitPrice.ToValue<System.Decimal>(),
ProductName = ProductFields.ProductName.ToValue<System.String>(),
CategoryName = CategoryFields.CategoryName.ToValue<System.String>(),
SupplierName = SupplierFields.CompanyName.ToValue<System.String>(),
ShipperName = ShipperFields.CompanyName.ToValue<System.String>()
})
.From(this.OrderDetails
.InnerJoin(this.Order).On(OrderDetailsFields.OrderId.Equal(OrderFields.OrderId))
.InnerJoin(this.Product).On(OrderDetailsFields.ProductId.Equal(ProductFields.ProductId))
.InnerJoin(this.Customer).On(OrderFields.CustomerId.Equal(CustomerFields.CustomerId))
.InnerJoin(this.Shipper).On(OrderFields.ShipVia.Equal(ShipperFields.ShipperId))
.InnerJoin(this.Category).On(ProductFields.CategoryId.Equal(CategoryFields.Id))
.InnerJoin(this.Supplier).On(ProductFields.SupplierId.Equal(SupplierFields.Id)));
}
// generated Pocos:
///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on: donderdag 10 april 2014 17:05:06
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
namespace Northwind.Adapter.TypedListClasses
{
/// <summary>Class which represents a row in the typed list 'OneToManyPocoQs'.</summary>
/// <remarks>This class is a result class for a query, which is produced with the method <see cref="Northwind.AdapterQueryFactory.GetOneToManyPocoQsTypedList"/>.
/// Contains the following entity definition(s):
/// Entity: Customer. Aliassed as: C <br/>
/// Entity: Order. Aliassed as: O <br/>
/// Entity: OrderDetails. Aliassed as: Od <br/>
/// Custom Properties: <br/>
/// </remarks>
[Serializable]
public partial class OneToManyPocoQsRow
{
#region Extensibility Method Definitions
partial void OnCreated();
#endregion
/// <summary>Initializes a new instance of the <see cref="OneToManyPocoQsRow"/> class.</summary>
public OneToManyPocoQsRow()
{
OnCreated();
}
#region Class Property Declarations
/// <summary>Gets the CustomerId field. Mapped onto 'C.CustomerId'</summary>
public System.String CustomerId { get; set; }
/// <summary>Gets the CompanyName field. Mapped onto 'C.CompanyName'</summary>
public System.String CompanyName { get; set; }
/// <summary>Gets the OrderId field. Mapped onto 'O.OrderId'</summary>
public System.Int32 OrderId { get; set; }
/// <summary>Gets the OrderDate field. Mapped onto 'O.OrderDate'</summary>
public Nullable<System.DateTime> OrderDate { get; set; }
/// <summary>Gets the Discount field. Mapped onto 'Od.Discount'</summary>
public System.Single Discount { get; set; }
/// <summary>Gets the ProductId field. Mapped onto 'Od.ProductId'</summary>
public System.Int32 ProductId { get; set; }
/// <summary>Gets the Quantity field. Mapped onto 'Od.Quantity'</summary>
public System.Int16 Quantity { get; set; }
#endregion
}
}
///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on: donderdag 10 april 2014 17:05:06
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
namespace Northwind.Adapter.TypedListClasses
{
/// <summary>Class which represents a row in the typed list 'OrderDetailsPocoWithQs'.</summary>
/// <remarks>This class is a result class for a query, which is produced with the method <see cref="Northwind.AdapterQueryFactory.GetOrderDetailsPocoWithQsTypedList"/>.
/// Contains the following entity definition(s):
/// Entity: Category. <br/>
/// Entity: Customer. <br/>
/// Entity: Order. <br/>
/// Entity: OrderDetails. <br/>
/// Entity: Product. <br/>
/// Entity: Shipper. <br/>
/// Entity: Supplier. <br/>
/// Custom Properties: <br/>
/// </remarks>
[Serializable]
public partial class OrderDetailsPocoWithQsRow
{
#region Extensibility Method Definitions
partial void OnCreated();
#endregion
/// <summary>Initializes a new instance of the <see cref="OrderDetailsPocoWithQsRow"/> class.</summary>
public OrderDetailsPocoWithQsRow()
{
OnCreated();
}
#region Class Property Declarations
/// <summary>Gets the CompanyName field. Mapped onto 'Customer.CompanyName'</summary>
public System.String CompanyName { get; set; }
/// <summary>Gets the OrderId field. Mapped onto 'Order.OrderId'</summary>
public System.Int32 OrderId { get; set; }
/// <summary>Gets the OrderDate field. Mapped onto 'Order.OrderDate'</summary>
public Nullable<System.DateTime> OrderDate { get; set; }
/// <summary>Gets the Discount field. Mapped onto 'OrderDetails.Discount'</summary>
public System.Single Discount { get; set; }
/// <summary>Gets the Quantity field. Mapped onto 'OrderDetails.Quantity'</summary>
public System.Int16 Quantity { get; set; }
/// <summary>Gets the UnitPrice field. Mapped onto 'OrderDetails.UnitPrice'</summary>
public System.Decimal UnitPrice { get; set; }
/// <summary>Gets the ProductName field. Mapped onto 'Product.ProductName'</summary>
public System.String ProductName { get; set; }
/// <summary>Gets the CategoryName field. Mapped onto 'Category.CategoryName'</summary>
public System.String CategoryName { get; set; }
/// <summary>Gets the SupplierName field. Mapped onto 'Supplier.CompanyName'</summary>
public System.String SupplierName { get; set; }
/// <summary>Gets the ShipperName field. Mapped onto 'Shipper.CompanyName'</summary>
public System.String ShipperName { get; set; }
#endregion
}
}
///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on: donderdag 10 april 2014 17:05:06
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
namespace Northwind.Adapter.TypedListClasses
{
/// <summary>Class which represents a row in the typed list 'OneToManyPocoLinq'.</summary>
/// <remarks>This class is a result class for a query, which is produced with the method <see cref="Northwind.AdapterLinqMetaData.GetOneToManyPocoLinqTypedList"/>.
/// Contains the following entity definition(s):
/// Entity: Customer. Aliassed as: C <br/>
/// Entity: Order. Aliassed as: O <br/>
/// Entity: OrderDetails. Aliassed as: Od <br/>
/// Custom Properties: <br/>
/// </remarks>
[Serializable]
public partial class OneToManyPocoLinqRow
{
#region Extensibility Method Definitions
partial void OnCreated();
#endregion
/// <summary>Initializes a new instance of the <see cref="OneToManyPocoLinqRow"/> class.</summary>
public OneToManyPocoLinqRow()
{
OnCreated();
}
#region Class Property Declarations
/// <summary>Gets the CustomerId field. Mapped onto 'C.CustomerId'</summary>
public System.String CustomerId { get; set; }
/// <summary>Gets the CompanyName field. Mapped onto 'C.CompanyName'</summary>
public System.String CompanyName { get; set; }
/// <summary>Gets the OrderId field. Mapped onto 'O.OrderId'</summary>
public System.Int32 OrderId { get; set; }
/// <summary>Gets the OrderDate field. Mapped onto 'O.OrderDate'</summary>
public Nullable<System.DateTime> OrderDate { get; set; }
/// <summary>Gets the Discount field. Mapped onto 'Od.Discount'</summary>
public System.Single Discount { get; set; }
/// <summary>Gets the ProductId field. Mapped onto 'Od.ProductId'</summary>
public System.Int32 ProductId { get; set; }
/// <summary>Gets the Quantity field. Mapped onto 'Od.Quantity'</summary>
public System.Int16 Quantity { get; set; }
#endregion
}
}
///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on: donderdag 10 april 2014 17:05:06
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
namespace Northwind.Adapter.TypedListClasses
{
/// <summary>Class which represents a row in the typed list 'OrderDetailsPocoWithLinq'.</summary>
/// <remarks>This class is a result class for a query, which is produced with the method <see cref="Northwind.AdapterLinqMetaData.GetOrderDetailsPocoWithLinqTypedList"/>.
/// Contains the following entity definition(s):
/// Entity: Category. <br/>
/// Entity: Customer. <br/>
/// Entity: Order. <br/>
/// Entity: OrderDetails. <br/>
/// Entity: Product. <br/>
/// Entity: Shipper. <br/>
/// Entity: Supplier. <br/>
/// Custom Properties: <br/>
/// </remarks>
[Serializable]
public partial class OrderDetailsPocoWithLinqRow
{
#region Extensibility Method Definitions
partial void OnCreated();
#endregion
/// <summary>Initializes a new instance of the <see cref="OrderDetailsPocoWithLinqRow"/> class.</summary>
public OrderDetailsPocoWithLinqRow()
{
OnCreated();
}
#region Class Property Declarations
/// <summary>Gets the CompanyName field. Mapped onto 'Customer.CompanyName'</summary>
public System.String CompanyName { get; set; }
/// <summary>Gets the OrderId field. Mapped onto 'Order.OrderId'</summary>
public System.Int32 OrderId { get; set; }
/// <summary>Gets the OrderDate field. Mapped onto 'Order.OrderDate'</summary>
public Nullable<System.DateTime> OrderDate { get; set; }
/// <summary>Gets the Discount field. Mapped onto 'OrderDetails.Discount'</summary>
public System.Single Discount { get; set; }
/// <summary>Gets the Quantity field. Mapped onto 'OrderDetails.Quantity'</summary>
public System.Int16 Quantity { get; set; }
/// <summary>Gets the UnitPrice field. Mapped onto 'OrderDetails.UnitPrice'</summary>
public System.Decimal UnitPrice { get; set; }
/// <summary>Gets the ProductName field. Mapped onto 'Product.ProductName'</summary>
public System.String ProductName { get; set; }
/// <summary>Gets the CategoryName field. Mapped onto 'Category.CategoryName'</summary>
public System.String CategoryName { get; set; }
/// <summary>Gets the SupplierName field. Mapped onto 'Supplier.CompanyName'</summary>
public System.String SupplierName { get; set; }
/// <summary>Gets the ShipperName field. Mapped onto 'Shipper.CompanyName'</summary>
public System.String ShipperName { get; set; }
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment