How am I issuing the query twice?
using (var tx = _session.BeginTransaction())
{
var market = _session.Query<Market>().Where(m => m.Id ==
[ID]).Single();
}
That is one select and it is being issued two times. What am I
missing?
On Apr 12, 9:45 am, Fabio Maulo <[email protected]> wrote:
> because you are doing the query two times ?
> note: Query<T> != session.Get<T>
>
>
>
>
>
>
>
>
>
> On Tue, Apr 12, 2011 at 11:36 AM, rhartzog <[email protected]> wrote:
> > If I issue a Get<T>(id) against the session I receive a single query:
>
> > SELECT market0_.Id as Id15_0_,
> > market0_.Name as Name15_0_,
> > market0_.Code as Code15_0_,
> > market0_.DesignCityCode as DesignCi4_15_0_,
> > market0_.Disclaimer as Disclaimer15_0_,
> > market0_.WarrantyEmail as Warranty6_15_0_,
> > market0_.Phone_AreaCode as Phone7_15_0_,
> > market0_.Phone_Prefix as Phone8_15_0_,
> > market0_.Phone_Suffix as Phone9_15_0_,
> > market0_.Phone_Extension as Phone10_15_0_,
> > market0_.Latitude as Latitude15_0_,
> > market0_.Longitude as Longitude15_0_,
> > market0_.Icon as Icon15_0_,
> > market0_.Zoom as Zoom15_0_,
> > market0_.State as State15_0_
> > FROM Markets market0_
> > WHERE market0_.Id = '[ID]' /* @p0 */
>
> > If I use the linq provider it issues two queries and I can't figure
> > out why. I have tried both _session.Query<Market>().Where(m => m.Id
> > == [ID]).Single() and I have also tried (from m in
> > _session.Query<Market>() where m.Id == [ID] select m).Single(). Both
> > of these result in two queries, the only difference is the
> > capitalization in nhprof. I can't figure out why it would be issuing
> > two selects. (No, I do not have both of the above queries in at the
> > same time. I switched them out for testing and both resulted in the
> > same thing):
>
> > SELECT market0_.Id as Id15_0_,
> > market0_.Name as Name15_0_,
> > market0_.Code as Code15_0_,
> > market0_.DesignCityCode as DesignCi4_15_0_,
> > market0_.Disclaimer as Disclaimer15_0_,
> > market0_.WarrantyEmail as Warranty6_15_0_,
> > market0_.Phone_AreaCode as Phone7_15_0_,
> > market0_.Phone_Prefix as Phone8_15_0_,
> > market0_.Phone_Suffix as Phone9_15_0_,
> > market0_.Phone_Extension as Phone10_15_0_,
> > market0_.Latitude as Latitude15_0_,
> > market0_.Longitude as Longitude15_0_,
> > market0_.Icon as Icon15_0_,
> > market0_.Zoom as Zoom15_0_,
> > market0_.State as State15_0_
> > FROM Markets market0_
> > WHERE market0_.Id = '[ID]' /* @p0 */
>
> > select market0_.Id as Id15_,
> > market0_.Name as Name15_,
> > market0_.Code as Code15_,
> > market0_.DesignCityCode as DesignCi4_15_,
> > market0_.Disclaimer as Disclaimer15_,
> > market0_.WarrantyEmail as Warranty6_15_,
> > market0_.Phone_AreaCode as Phone7_15_,
> > market0_.Phone_Prefix as Phone8_15_,
> > market0_.Phone_Suffix as Phone9_15_,
> > market0_.Phone_Extension as Phone10_15_,
> > market0_.Latitude as Latitude15_,
> > market0_.Longitude as Longitude15_,
> > market0_.Icon as Icon15_,
> > market0_.Zoom as Zoom15_,
> > market0_.State as State15_
> > from Markets market0_
> > where market0_.Id = '[ID]' /* @p0 */
>
> > Notice the queries are exactly the same except for the
> > capitalization. NHProf build is 837 and NHibernate version is
> > 3.1.0.4000. I can't figure this out and would appreciate some help.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.