fluent nhibernate - Losing the record ID -


I have a record structure where I have parental record with many children's records. On the same page, There will be some questions to get.

One subsequent query will get me a detailed set, when I increase it, it shows "proxy". It is all right to get data from the record because everything is usually done. I only have a problem when I go to get the record "id", it always is "0" because it is a proxy, making it a lot difficult when creating a dropdown list, where I have a "selected value" Using record id What makes this bad is it's random. Therefore, out of the 5 items list, 2 will have an ID of "0" because they are a proxy.

I can force the use of eviction to be loaded on time. But when I need lazy load (for grid), the eviction is bad, because it kills lazy loads and I can not show grid content on the fly.

I started using the following to start my session: Issension session = Fluent session manager. Session Fact. Open Session (); Session.BeginTransaction (); CurrentSessionContext.Bind (session);

I also use "SetsFetchMode" ("MyTable", "Curious)" within my queries and it still shows "Proxy"

I need a record ID

Thank you.

There is a question here, I am running, which will be the result of patients. Children keep an ID of "0" Because it is showing as a "proxy":

  public IList & lt; patients & gt; GetAllPatients () {FluentSessionManager.GetSession (.) .CreateCriter Ia do & lt return; Patients & gt; () .Add (Expression.Eq ("isDeleted", Incorrect)) .SetFetchMode ("Children", Curious) .List & LT; Patients & gt; ();}  

I found the silver tablet that proxy issue you loose, where your record fixes! I was using ClearCache to take care of the problem, it worked fine for the first two layers in the record structure, however, when you have the scenario of the presenter, the child.Another level. One more.Down one who will not decide the fourth and fifth level. I came with this method. I also came to know that most of it present itself, when I have many people after one mapping after one, then here Everyone out there that is running in the same problem is out there

Domain structure:

  Public class generator:. DomainBase & LT; Integer & gt; {Public virtual id id ({return base.ID2;} set {base.ID2 = value;}} public virtual string {get} set;} ....}   

DomainBase : Public intangible class DomainBase & LT; Y & gt;, IDomainBase & lt; Y & gt; {public virtual y id / // everything is an identifier key; } Secure Internal Virtual Y ID2 / Real Identity Key {Receive {Y myID = this.ID; if (typeof (Y) .toString () == "System.Int32") {if (int.Parse (this.ID .toString ()) == 0} {MyID = ReadOnlyID;}} MyID return;} Set {this.ID = value; This.ReadOnlyID = Original E;;}} protected internal virtual Y ReadOnlyID {get} set}} // real identity key}

IDomainBase:

  public interface idomainBase & lt; Y & gt; {Y ID (Receive; Set;}}   

Domain Mapping:

  Public Class Parents: Classmap & lt; Parent, int> {schema ("dbo"); table ("father"); id (x = & gt; x.id); map (x = & gt; X.Name); Class}}  

Tenty Type, TIDType & gt; : FluenNHbearnet. Mapping Classmaps & lt; Tentety type & gt; Where Tementetty Type: Domainbase and lieutenant; TidyType & gt; {Public class mark () {id (x => x.id, "id"); Map (x = & gt; x.ReadOnlyID, "ID"). ready only (); }}

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

c# - Add Image in a stackpanel based on textbox input -

java - Reaching JTextField in a DocumentListener -