Linq for NHibernateFunctions
Bobby Diaz is still producing some amazing stuff. The new addition is native support for SQL functions. Take a look at this code:
var query = ( from e in db.Employees
where db.Methods.Year(e.BirthDate) >= date.Year && db.Methods.Len(e.FirstName) > 4
select e.FirstName )
.Aggregate(new StringBuilder(), (sb, name) => sb.Length > 0 ? sb.Append(", ").Append(name) : sb.Append(name));
Console.WriteLine("Birthdays after {0}:", date.ToString("yyyy"));
Console.WriteLine(query);
Check out Bobby's post for the full details. I am going to write a full overview of the current state of Linq for NHibernate soon. The situation so far is looking very nice.
More posts in "Linq for NHibernate" series:
- (14 Apr 2007) Functions
- (05 Apr 2007) More Implementation Details
- (20 Mar 2007) Orderring and Paging
Comments
Just added another post with more sample queries:
http://blogs.magiconsoftware.com/blogs/bdiaz/archive/2007/04/15/linq-query-samples-2.aspx
Thanks for the props!
Bobby
Comment preview