linq-to-nhibernate

Linq2NHibernate - Only Left Joins?

Really quick question.. Does Linq2NHibernate always create a left join to retrieve relationships? Is there a way that I can get an inner one instead? Thank you in advance. Filipe ...

NHibernate .Query returning stale data

This is my unit test (it's quite meaningless but proves a point Config entity = new Config("key", "value"); Session.SaveOrUpdate(entity); Config config = Session.Query<Config>().SingleOrDefault(c => c.Key == "key"); Assert.IsNotNull(config); it fails...but I don't think it should (note, if I flush it, it doesn't fail, but that's ...

Linq to NHibernate .ContainsAny() workaround?

Hi, I've rammed into a huge problem. I got to these two objects: IList<Product> products; and Collection collection; Both objects contains and IList<Tag> named .Tags. I'm trying to do the this with Linq To NHibernate: products = products.Where(p => p.Tags.Any(t => collection.Tags.Contains(t))); This will give an exception, because ...

Can you perform complex aggregate operations using NH3?

I need to perform a grouping aggregation similar to something like this in T-SQL: select b.Name as [Grouped Name], COUNT(distinct a.ID) as [Grouped Count], COUNT(distinct c1.ID) as [Second Group Count], COUNT(distinct c2.ID) as [Third Group Count] from TableA a left join TableB b on a.ID = b.TableAID left join TableC c1 on a.ID = c1.T...

How do I express this LINQ query using the NHibernate ICriteria API?

My current project is using NHibernate 3.0b1 and the NHibernate.Linq.Query<T>() API. I'm pretty fluent in LINQ, but I have absolutely no experience with HQL or the ICriteria API. One of my queries isn't supported by the IQueryable API, so I presume I need to use one of the previous APIs -- but I have no idea where to start. I've tried s...

nhibernate linq and let keyword

Is this possible to use let keyword with nhibernate linq? I wrote posts = from post in postsRepository.GetPosts(name) let commentsCount = (from c in NHUnitOfWork.CurrentSession.Linq<Comment>() where c.Post.ID == post.ID select c).Count() select new ... and in r...