I'm trying to evaluate NHibernate.LINQ 1.0 without actually writing any code. Ayende has admitted that this version of LINQ support is subpar compared to EF, but for the life of me I can't seem to find a page that explains what's supported and unsupported in this implementation. For example, can I use Skip
& Take
? What can I not use?
You can check LINQ for NHibernate examples to see tests done by Ayende himself on what's implemented and what's not for this provider.
Some of those generally supported:
new { Person = x.Name }
query.First()
query.FirstOrDefault()
query.Single()
query.SingleOrDefault()
query.Aggregate((x1,x2) => x1)
query.Where(x => x.Name.Contains("Foo"))
where db.Methods.Substring(e.FirstName, 1, 2) == "An"
query.Where(x => x.Company.Id == 4)
query.Where(x => x.Relatives.Count > 0)
query.Any()
query.Take(10)
query.Take(10).Skip(4)
orderby x.Name descending
AfterMethod = e.FirstName.Replace("An", "Zan"),
where db.Methods.CharIndex(e.FirstName, 'A') == 1
where e.FirstName.IndexOf("An") == 1
Problematic:
One of my own examples:
query = NSession.Session.Linq<Catalog>() .Where(acc => acc.Company.Status == "A") .Where(acc => acc.Id.StartsWith("12-536")) .Where(acc => acc.Id.EndsWith("92") || acc.Id.EndsWith("67")) .Take(10).OrderBy(acc => acc.Title);
If you're production application is using the latest stable build 2.1.2.4 like I am, you're stuck with what the NHibernate.Linq provider gives us until NHibernate 3.0 (trunk) gets a stable release and we feel safe enough to use it on major applications. Until then, I'm more than happy with a mixture of NHibernate.Linq and HQL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With