Note that there are some explanatory texts on larger screens.

plurals
  1. POLosing the record ID
    primarykey
    data
    text
    <p>I have a record structure where I have a parent record with many children records. On the same page I will have a couple queries to get all the children.</p> <p>A later query I will get a record set when I expand it it shows "Proxy". That is fine an all for getting data from the record since everything is generally there. Only problem I have is when I go to grab the record "ID" it is always "0" since it is proxy. This makes it pretty tough when building a dropdown list where I use the record ID as the "selected value". What makes this worse is it is random. So out of a list of 5 items 2 of them will have an ID of "0" because they are proxy.</p> <p>I can use evict to force it to load at times. However when I am needing lazy load (For Grids) the evict is bad since it kills the lazy load and I can't display the grid contents on the fly.</p> <p>I am using the following to start my session:</p> <pre><code>ISession session = FluentSessionManager.SessionFactory.OpenSession(); session.BeginTransaction(); CurrentSessionContext.Bind(session); </code></pre> <p>I even use ".SetFetchMode("MyTable", Eager)" within my queries and it still shows "Proxy". </p> <p>Proxy is fine, but I need the record ID. Anyone else run into this and have a simple fix?</p> <p>I would greatly appreciate some help on this.</p> <p>Thanks.</p> <p>Per request, here is the query I am running that will result in Patients.Children having an ID of "0" because it is showing up as "Proxy":</p> <pre><code> public IList&lt;Patients&gt; GetAllPatients() { return FluentSessionManager.GetSession() .CreateCriteria&lt;Patients&gt;() .Add(Expression.Eq("IsDeleted", false)) .SetFetchMode("Children", Eager) .List&lt;Patients&gt;(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload