c# - XPCollection Not Loading -
i have xpcollection in 1 of classes. it's xpcollection of class. when run app xpcollection not loaded. can see in breakpoint when debugging. here code using in object. :
private xpcollection<limitallocationtotals> _limitallocationtotals; public xpcollection<limitallocationtotals> limitallocationtotals limitallocationtotals { { if (limitallocations.isloaded && limitallocations != null) { unitofwork uow = new unitofwork(); _limitallocationtotals = new xpcollection<limitallocationtotals>(uow, new binaryoperator("oid", guid.empty)); _limitallocationtotals.session = this.session; foreach (limitallocation allocation in limitallocations) { limitallocationtotals allocationtotals = new limitallocationtotals(this.session); allocationtotals.mtmlimit += allocation.mtmlimit; allocationtotals.arlimit += allocation.arlimit; allocationtotals.volume += allocation.volume; allocationtotals.maxtenor = allocation.maxtenor; allocationtotals.sourceentity = allocation.sourceentity; allocationtotals.commodity = allocation.commodity; allocationtotals.convertedvolume = allocation.convertedvolume; _limitallocationtotals.add(allocationtotals); } foreach (limitextension extension in limitextensions) { if (extension.expirationdate >= datetime.now) { limitallocationtotals searchallocation = null; foreach (limitallocationtotals allocation in _limitallocationtotals) { if (allocation.sourceentity != null && allocation.sourceentity.oid.equals(extension.sourceentity.oid)) { searchallocation = allocation; break; } } if (searchallocation == null) { searchallocation = new limitallocationtotals(this.session); searchallocation.sourceentity = extension.sourceentity; _limitallocationtotals.add(searchallocation); } searchallocation.mtmlimit += extension.mtmlimit; searchallocation.arlimit += extension.arlimit; searchallocation.volume += extension.volume; searchallocation.commodity = extension.commodity; searchallocation.maxtenor += extension.maxtenor; // searchallocation.calculatemeasureconversion(_commodity, _volumeunit); //searchallocation.volumeunit = extension.volumeunit; } } } return _limitallocationtotals; } set { setpropertyvalue("limitallocationtotals", ref _limitallocationtotals, value); } }
an xpcollection
loaded on demand. the documentation:
in cases, collection needs created access objects of specific type data store.
xpcollection
class implements delayed loading, i.e. it's populated persistent objects data store on demand. instance, can createxpcollection
instance, marked contain custom person objects. collection, however, populated person objects data store when collection's contents accessed.
you can force load data store calling xpcollection.load()
this should not necessary.
Comments
Post a Comment