page header

Using Typed Views

For NHibernate, LLBLGen Pro supports Typed View definitions mapped onto tables and views. The class name of a row in the typed view is TypedViewNameTypedViewRow. It doesn't matter if your view only has nullable fields or your table doesn't have a primary key, the first field is chosen. The Typed View row class is a readonly bucket, which shouldn't be used for saving data, only for fetching data.s

Typed views mapped onto a table or view

A typed view mapped onto a table or view is retrievable like an entity and usable in queries like entities. In the example below a Criteria query is created to fetch the typed view mapped onto the Invoices view in Northwind to fetch the first 10 rows.

// C#
ISession session = SessionManager.OpenSession();
IList<InvoicesTypedViewRow> invoices = session.CreateCriteria(typeof(InvoicesTypedViewRow))
					.SetMaxResults(10)
					.List<InvoicesTypedViewRow>();
' VB.NET
Dim session As ISession = SessionManager.OpenSession()
Dim invoices As IList(Of InvoicesTypedViewRow) = session.CreateCriteria(typeof(InvoicesTypedViewRow)) _
						.SetMaxResults(10) _
						.List(Of InvoicesTypedViewRow)()

NHibernate Support documentation for LLBLGen Pro v4.2. ©2002-2014 Solutions Design