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.

ISession session = SessionManager.OpenSession();
IList<InvoicesTypedViewRow> invoices = session.CreateCriteria(typeof(InvoicesTypedViewRow))
                    .SetMaxResults(10)
                    .List<InvoicesTypedViewRow>();