Here is the trunk of what you are using
http://nhcontrib.svn.sourceforge.net/viewvc/nhcontrib/trunk/src/NHibernate.Linq/src/

2009/5/28 Mark Nijhof <[email protected]>

>
> I am not at the work machine so I can't reproduce but it is the
> version that comes with Fluent NHibernate v.0.1.0.447 so it is a
> little while back I tried to see if I could still download that but
> the link was not available anymore.
>
> Rebuilding will not be a big issue, but cannot do anything more on
> that tomorrow except try answer more questions, sorry.
>
> -Mark
>
>
>
>
> On Thu, May 28, 2009 at 10:07 PM, Fabio Maulo <[email protected]>
> wrote:
> > Moment... we are forgetting something...
> > @Mark
> > Which NH-Linq version are you using ?
> > I know that is a difficult question but try to download and recompile the
> > trunk of NH-Linq
> >
> > 2009/5/28 Tuna Toksoz <[email protected]>
> >>
> >> As long as the object used in parameter is a constant, its value is
> >> evaluated and used as constant
> >>
> >>             Employee ee = new Employee();
> >>             ee.BirthDate = DateTime.Now;
> >>             var q =
> >>                 from e in db.Employees
> >>                 where e.HireDate >= ee.BirthDate
> >>                 select e;
> >>
> >> Resulted in
> >>
> >>
> >>
> NHibernate: SELECT this_.EmployeeID as EmployeeID17_0_, this_.Address as 
> Address17_0_, this_.BirthDate as BirthDate17_0_, this_.City as City17_0_, 
> this_.Country as Country17_0_,
> >>
> >>
> this_.Extension as Extension17_0_, this_.FirstName as FirstName17_0_, 
> this_.HireDate as HireDate17_0_, this_.HomePhone as HomePhone17_0_, 
> this_.LastName as LastName17_0_,
> >>
> >>
> this_.Notes as Notes17_0_, this_.Photo as Photo17_0_, this_.PhotoPath as 
> PhotoPath17_0_, this_.PostalCode as PostalCode17_0_, this_.Region as 
> Region17_0_, this_.Title as Title17_0_,
> >>
> >>
> this_.TitleOfCourtesy as TitleOf17_17_0_ FROM Employees this_ WHERE 
> this_.HireDate >= @p0; @p0 = '5/28/2009 10:58:38 PM'
> >>
> >>
> >>
> >> Tuna Toksöz
> >> Eternal sunshine of the open source mind.
> >>
> >> http://devlicio.us/blogs/tuna_toksoz
> >> http://tunatoksoz.com
> >> http://twitter.com/tehlike
> >>
> >>
> >>
> >>
> >> On Thu, May 28, 2009 at 10:56 PM, Fabio Maulo <[email protected]>
> >> wrote:
> >>>
> >>> Tuna, You should check what happen when the value come from a property
> or
> >>> a method of a object used as criteria.
> >>> Take a look to "req.FromDate" probably "req" is a custom class used to
> >>> hold query info.
> >>>
> >>> 2009/5/28 Tuna Toksoz <[email protected]>
> >>>>
> >>>> The trunk and very early revisions of linq trunk worked in that way, I
> >>>> believe.
> >>>>
> >>>> Tuna Toksöz
> >>>> Eternal sunshine of the open source mind.
> >>>>
> >>>> http://devlicio.us/blogs/tuna_toksoz
> >>>> http://tunatoksoz.com
> >>>> http://twitter.com/tehlike
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Thu, May 28, 2009 at 10:36 PM, Mark Nijhof <[email protected]>
> >>>> wrote:
> >>>>>
> >>>>> What version should we use?
> >>>>>
> >>>>> On Thu, May 28, 2009 at 9:29 PM, Tuna Toksoz <[email protected]>
> wrote:
> >>>>> >
> >>>>> >
> NHibernate: SELECT this_.EmployeeID as EmployeeID17_0_, this_.Address as 
> Address17_0_, this_.BirthDate as BirthDate17_0_, this_.City as City17_0_, 
> this_.Country as Country17_0_,
> >>>>> >
> >>>>> >
>  this_.Extension as Extension17_0_, this_.FirstName as FirstName17_0_, 
> this_.HireDate as HireDate17_0_, this_.HomePhone as HomePhone17_0_, 
> this_.LastName as LastName17_0_,
> >>>>> >
> >>>>> >
>  this_.Notes as Notes17_0_, this_.Photo as Photo17_0_, this_.PhotoPath as 
> PhotoPath17_0_, this_.PostalCode as PostalCode17_0_, this_.Region as 
> Region17_0_, this_.Title as Title17_0_,
> >>>>> >
> >>>>> >
>  this_.TitleOfCourtesy as TitleOf17_17_0_ FROM Employees this_ WHERE 
> this_.HireDate >= @p0; @p0 = '1/1/1994 12:00:00 AM'
> >>>>> >
> >>>>> > What I get when I run
> >>>>> >
> >>>>> >         [Category("WHERE")]
> >>>>> >         [Test(Description = "This sample uses WHERE to filter for
> >>>>> > Employees
> >>>>> > hired during or after 1994.")]
> >>>>> >         public void DLinq2()
> >>>>> >         {
> >>>>> >             var q =
> >>>>> >                 from e in db.Employees
> >>>>> >                 where e.HireDate >= new DateTime(1994, 1, 1)
> >>>>> >                 select e;
> >>>>> >             AssertByIds(q, new[] { 7, 8, 9 }, x => x.EmployeeID);
> >>>>> >         }
> >>>>> >
> >>>>> > in tests.
> >>>>> >
> >>>>> >
> >>>>> >
> >>>>> >
> >>>>> > Tuna Toksöz
> >>>>> > Eternal sunshine of the open source mind.
> >>>>> >
> >>>>> > http://devlicio.us/blogs/tuna_toksoz
> >>>>> > http://tunatoksoz.com
> >>>>> > http://twitter.com/tehlike
> >>>>> >
> >>>>> >
> >>>>> >
> >>>>> >
> >>>>> > On Thu, May 28, 2009 at 10:27 PM, Tuna Toksoz <[email protected]>
> >>>>> > wrote:
> >>>>> >>
> >>>>> >> Really? hmm, I'll check
> >>>>> >>
> >>>>> >> Tuna Toksöz
> >>>>> >> Eternal sunshine of the open source mind.
> >>>>> >>
> >>>>> >> http://devlicio.us/blogs/tuna_toksoz
> >>>>> >> http://tunatoksoz.com
> >>>>> >> http://twitter.com/tehlike
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >> On Thu, May 28, 2009 at 10:20 PM, Mark Nijhof
> >>>>> >> <[email protected]>
> >>>>> >> wrote:
> >>>>> >>>
> >>>>> >>> Hi Fabio,
> >>>>> >>>
> >>>>> >>> Looks like it is NH.Linq that does the ToString():
> >>>>> >>>
> >>>>> >>> from
> >>>>> >>> t in
> >>>>> >>> NhibSessionHelper.GetSession().Linq<ExternalSystemStatusInfo>()
> >>>>> >>> where t.FromDate > req.FromDate &&
> >>>>> >>> (t.ToDate < req.ToDate.Value || t.ToDate == null) &&
> >>>>> >>> (t.ExternalSystem.Code == req.Code)
> >>>>> >>> orderby t.FromDate
> >>>>> >>> select t
> >>>>> >>>
> >>>>> >>> What would be a sugested way to solve this?
> >>>>> >>>
> >>>>> >>> -Mark
> >>>>> >>>
> >>>>> >>> On Thu, May 28, 2009 at 9:04 PM, Fabio Maulo <
> [email protected]>
> >>>>> >>> wrote:
> >>>>> >>> > as you can see something/somebody is injecting strings instead
> >>>>> >>> > use
> >>>>> >>> > parameters; that is the problem.
> >>>>> >>> >
> >>>>> >>> > 2009/5/28 Mark Nijhof <[email protected]>
> >>>>> >>> >>
> >>>>> >>> >> Hi Fabio,
> >>>>> >>> >>
> >>>>> >>> >> SELECT
> >>>>> >>> >> this_.Id as Id37_1_,
> >>>>> >>> >> this_.FromDate as FromDate37_1_,
> >>>>> >>> >> this_.ToDate as ToDate37_1_,
> >>>>> >>> >> this_.Comment as Comment37_1_,
> >>>>> >>> >> this_.CustomerInfo as Customer5_37_1_,
> >>>>> >>> >> externalsy1_.Id as Id12_0_,
> >>>>> >>> >> externalsy1_.Code as Code12_0_,
> >>>>> >>> >> externalsy1_.Description as Descript3_12_0_
> >>>>> >>> >> FROM AuditLogDb.dbo.ExternalSystemStatusInfo this_
> >>>>> >>> >> left outer join AuditLogDb.dbo.ExternalSystem externalsy1_
> >>>>> >>> >> on this_.Id=externalsy1_.Id
> >>>>> >>> >> WHERE
> >>>>> >>> >>      ((this_.FromDate > '27.04.2009 15:06:21'
> >>>>> >>> >>      and (this_.ToDate < '27.06.2009 15:06:21' or this_.ToDate
> >>>>> >>> >> is
> >>>>> >>> >> null))
> >>>>> >>> >>      and externalsy1_.Code = 'TrustIdent')
> >>>>> >>> >> ORDER BY this_.FromDate asc;
> >>>>> >>> >>
> >>>>> >>> >> Both dates comes from properties on the entity.
> >>>>> >>> >>
> >>>>> >>> >> Thanks for helping out,
> >>>>> >>> >>
> >>>>> >>> >> -Mark
> >>>>> >>> >>
> >>>>> >>> >> On Thu, May 28, 2009 at 8:23 PM, Fabio Maulo
> >>>>> >>> >> <[email protected]>
> >>>>> >>> >> wrote:
> >>>>> >>> >> > 2009/5/28 Mark Nijhof <[email protected]>
> >>>>> >>> >> >>
> >>>>> >>> >> >> Sorry that only applies to the mappings of course. We are
> >>>>> >>> >> >> using
> >>>>> >>> >> >> Linq
> >>>>> >>> >> >> to access the data and regular save for saving.
> >>>>> >>> >> >
> >>>>> >>> >> > can you send the SQL log ?
> >>>>> >>> >> > --
> >>>>> >>> >> > Fabio Maulo
> >>>>> >>> >> >
> >>>>> >>> >> > >
> >>>>> >>> >> >
> >>>>> >>> >>
> >>>>> >>> >>
> >>>>> >>> >
> >>>>> >>> >
> >>>>> >>> >
> >>>>> >>> > --
> >>>>> >>> > Fabio Maulo
> >>>>> >>> >
> >>>>> >>> > >
> >>>>> >>> >
> >>>>> >>>
> >>>>> >>>
> >>>>> >>
> >>>>> >
> >>>>> >
> >>>>> > >
> >>>>> >
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Fabio Maulo
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
> > --
> > Fabio Maulo
> >
> > >
> >
>
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to