linq-to-nhibernate

Latest Binary builds of FLuentNhibernate + Nhibernate + Linq for NHibernate

do people build there own versions of all this? or is there a place to get all this prebuilt? I got the latest FluentNhibernate which has NHibernate but no Linq.... but I don't really want to setup a ruby rake build system etc etc unless I really really have to! Prefer to just get all the binaries I need. ...

Eager load while using Linq in NHibernate 3

I need help with eager loading in with Linq in NHibernate 3 trunk version. I have a many-to-many relationship like this: public class Post { public int Id {get;set;} public IList<Tag> Tags { get;set;} . . . } Now I have the following mapping in Fluent NHibernate public class PostMap:ClassMap<Post> { public ...

Deleted object would be re-saved by cascade

What I have is this: Domain.List has many ListToListMemberships called "SubLists" Domain.List also has many ListToListMemberships called "ParentLists" ListToListMembership has one List (the parent). ListToListMembership has another List (the member). Given this I want the following test to pass: [Test] public void WhenDeleti...

"No persister for" error with NHibernate, NHibernate.Linq and Fluent Mapping

Hi, I´m using Nhibernate 2.1.2.4000 GA with Nhibernate.Linq 1.0 and latest version of FluentNhibernate downloaded from master on github. Im doing some tests and whenever I try to delete a entity retrieved by a linq query i´m getting this error: No persister for: NHibernate.Linq.Query`1[[Employees.Core.Entities.Employee, Employees.Core...

NHibernate.Linq returning the wrong type

Hi, I'm attempting to use NHibernate.Linq to return objects deep from my object graph, and for some reason NHibernate is returning the root object. I don't know if I'm missing something, or if it is just a problem with NHibernate.Linq. The compiler correctly infers that I am trying to return an object of type FacilityInstruction when ...

Linq2nHibernate in business layer?

I would like to know, wheter it is a good idea and doesn't breaks n-tiered pattern, if I make the DAL return IQueryable - Collections and then use Linq in the BLL to do my queries? What is about n-tiered then? Does that mean, that all my entities are fetched from databased an then queried in memory?... that would be awesome... ...

linq searching matching items in child collection

Hi I am looking for a way to do a IN clause query on child collections in linq. I have a an example as follows: Entity: Product.CategoryAssignments - this is an IList<Category> that the product is assigned to. Product can be assigned to multiple categories. I want to retrieve all products matching in a list of categories i.e. ILis...

Selecting child projection from parent

Here are three classes in my domain: public class Quote : IEntity, IAggregateRoot { public int QuoteId { get; set; } public IEnumerable<Price> Prices { get; set; } } public class Price : IEntity { public int PriceId { get; set; } public Carrier Carrier { get; set; } public decimal? Price { get; set; } public Quo...

NHibernate ManyToMany CreateCriteria

I have 3 classes: Mail,MailHeader,User Mail has 2 properties: User and MailHeader MailHeader has IList of Users (MailsDeleted) Now i want all mails of a specific user, only if the property MailHeader.MailsDeleted does not contains that user In other words with Linq i use: var q = from sa in candidates wh...

How do a case-insenstive Where clause in LINQ-to-NHibernate with the Oracle provider?

For example, given the following code, how is it possible to make the string comparison case-insensitive? var query = from employeeGroup in _session.Linq<EmployeeGroup>() from employee in employeeGroup.Employee where employee.UserName == username select employeeGroup.Em...

Linq to objects error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

I am getting the following error when trying to return a list of new objects from a linq query. I am looking to return a stripped down entity for use in a selectbox and only need and id and name. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index myViewModel.Regions = _regionRep...

Strange problem with LINQ to NHibernate and string comparison

I'm using LINQ to NHibernate and encountered a strange problem while comparing strings. Following code works fine but when I un-comment: //MyCompareFunc(dl.DamageNumber, damageNumberSearch) && and comment: dl.DamageNumber.Contains(damageNumberSearch) && then it breaks down and seems that MyCompareFunc() always return true while dl.Damage...

Is it necessary not to use methods in LINQ queries?

Hi all, In following code is any difference when I put "dl.DamageCount > 5" directly in the query or when I move "dl.DamageCount > 5" to a method or function then just call it from query? It seems when I move it into a method, query does not work properly. Indeed it seems the function/method always return true regardless of condition e...

Why ordinary laws in evaluting boolean expression does not fit into LINQ?

In such a code: if (insuranceNumberSearch == null ? true : ei.InsuranceNumber.Contains(insuranceNumberSearch.Trim())) doSomething(); where insuranceNumberSearch is null, remaining expression is not null while in following code: var q = from ei in session.Linq<EmployeeInsurance>() where insuranceNumberSearch =...

Short-circuit evaluation and LINQ-to-NHibernate

It seems that LINQ-to-NHibernate and LINQ-to-SQL does not support short-circuit evaluation in where clause of query. Am I right? Is there any workaround? May it be added to next versions of LINQ-to-NHibernate and LINQ-to-SQL? for more information plz see followings: http://stackoverflow.com/questions/772261/the-or-operator-in-linq-w...

Is linq2nh ready for production?

It is asked before but that was one year back. I would like to know if it is ready for production now? ...

NHibernate Subquery Linq - How to select groups that contain a certain item by id

Short Version This query works in the database but fails with Linq To NHibernate. Why? var items = (from g in db.Find<DataGroupInfo>() where (from d in g.data where d.Id == dataID select d).Count() > 0 select g).ToList(); Detailed Long Version I have two objects mapped by NHibernate Automapper with a Ma...

Nested select not working in NHibernate.Linq

I want to load the list of users and their roles, with this query: var q = from u in session.Linq<User>() select new { u.Name, u.Password, Roles = from r in u.Roles select new { r.Code, r.Name } }; But this query is not working. Produce the following ...

ArgumentOutOfRangeException using ToString in LINQ to NHibernate query

I have a basic NHibernate.Linq query: var items = from item in session.Linq<ObjectType>() where item.ID > 0 select new { ID = item.ID, Type = item.ClassName }; This works fine. However, ObjectType is a heavy-weight class, and I only want ID and ClassName. So I've created a DTO called EntityInfo: public cla...

Basic Fluent NHibernate program compiles and runs, but nothing is saved to or loaded from database

I am trying a very simple Fluent Nhibernate example: SQL 2005 database with one table, VS2008 console application. The table has one record before the program starts. I am trying to add one record, then display all records from table. Programs successfully compiles and runs without any exceptions, however no records are displayed. HBM m...