I'm converting some code from Nhibernate 2.x to 3.0. Before, i was using the LINQ plugin, to get LINQ support. My understanding was that in 3.0 it got rolled in as a first class feature. So my question is, i used to have this:
return new List<T>(session.Linq<T>().Where(where));
What does that look like with the new syntax? i went through the nhib 3 docs and tutorial and didn't see anything about the linq stuff, so i couldn't find an example to pattern after.
NHibernate is an ORM (Object Relational Mapper). Its purpose is to map objects in your OO application to tables in a database for persistence. Why would you need it? Because it can save you from writing a lot of tedious ADO.NET code.
NHibernate 5.3 was released on July 19, 2020.
NHibernate is A tool that creates a "virtual representation" of database objects within the code. Used to solve the problem of impedance mismatch between Class and relational databases and tables.
NHibernate is a popular, fast growing ORM with a helpful community of seasoned developers. Used in thousands of commercial and open source projects.
In NHibernate 3 with Linq you do this:
from u in session.Query<User>()
where u.Username == username
select u
Or
session.Query<User>().Where(u => u.Username == username)
Not sure if this is what you're looking for.
EDIT: Query<T>
is an extension method. Don't forget to add the using NHibernate.Linq
to be able to use it.
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