If the Client has many Orders attached to them. How would you be lazy to load a list of orders using NHibernate.
Is this something you need to set up a mapping file? any help or example would be great.
Here is a good article:
http://blogs.chayachronicles.com/sonofnun/archive/2007/03/30/230.aspx
From the above article:
The most common is simply to mark the class with the attribute 'lazy = "true" or put' default-lazy = "true" in the mapping declaration:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="@core.assembly@" default-access="nosetter.camelcase-underscore" default-lazy="true">
or
<class name="Cei.eMerge.Core.Domain.Contacts.Contact" table="Contact" lazy="true" >
- , , , , Fetchmode :
criteria.SetFetchMode("Orders", FetchMode.Lazy)
, "lazy = true" . :
<bag name="EmploymentHistory" cascade="all" inverse="true" lazy="true"> <key column="PersonID" /> <one-to-many class="MyDomain.EmploymentRecord, MyDomainAssembly" /> </bag>
, , , .
Customer customer = session.CreateCriteria(...) .SetFetchMode("Orders", FetchMode.Lazy) .UniqueResult<Customer>(); Ilist<Order> orders = session.CreateFilter(customer.Orders," WHERE this.OrderDate < ?") .SetDateTime(...).List();
, Customer , ? , ., , :?
, ? , Customer., :
IList<Order> GetOrdersForCustomer( Customer c );
, .
Source: https://habr.com/ru/post/1704865/More articles:WCF - client proxy configuration does NOT match web.config - .nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1704861/build-servers-and-source-control-repositories&usg=ALkJrhjB41deD5KVE1GVnOR2vWB0zt5XgQКак десериализовать фрагмент Xml с помощью XML Reader - c#BCC recipient limits - java(Optional) Effective locking when rotating nodes in a threaded binary tree - multithreadingJquery Asp.net selectable row table - jqueryunix-fork-monitor-child-progress - c ++Strange annotation warning SAL - c ++Clojure graphic calculator. "-" always returns 0, and "/" always returns 1 - javanHibernate SetFirstResult & SetMaxResults Problems - c #All Articles