FNH is for setting up session factory, after you set it up, it is all about
NH itself

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Wed, Aug 26, 2009 at 9:09 PM, Josh Coffman <[email protected]> wrote:

> I assume some have already gotten LinqNH going with FNH.  Could someone
> enlighten me?  It was really simple to just add the nh.linq.dll and then I
> could run a linq query like this:
>
> var list = from c in session.Linq<User>()
>                 where c.FirstName.StartsWith("J")
>                 select c;
>
> But is that the recommended way?  The User class has IList<TimeEntry>
> TimeEntries mapped, and that works.  Is it legitmate to use linq on it?  I
> wrote a test and it worked.  I'm new to linq and FNH and NHib; I've used
> Castle AR but never NH directly before.
>
> My initial test looks like this (no actual TimeEntry records exist in the
> integration test db)
>
> [Fact]
> public void CanQueryTimeEntriesWithLinq()
> {
>    var session = base.CreateSessionFactory().OpenSession();
>    var userList = session.CreateCriteria(typeof(User)).List<User>();
>    var user = userList[0];
>
>    var list = from c in user.TimeEntries
>       where c.EntryDate > DateTime.UtcNow.AddMonths(-1)
>       select c;
>
>    Assert.NotNull(list);
> }
>
> Thanks,
> -j
>
>
> Josh C.
> 480-270-4578 | josh [at] computeristsolutions [dot] com |
> http://computeristsolutions.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to