Contents tagged with NHibernate
-
Succinctly Books Index
This page lists all the books I wrote or reviewed for Syncfusion’s Succinctly series.
-
Lesser-Known NHibernate Features: Executable HQL
What happens when you need to bulk change a lot of records on the database? The unwary novice might be tempted to load data from the database into class instances, change them and then either rely on change tracking to eventually make the changes persistent or even worse, explicitly do an update on every possibly changed entity. The non-novice readers should now rolling their eyes.var records = session.CreateQuery("update Person p set p.Email = p.Email + p.Username + '@somedomain.com' where p.Email is null").ExecuteUpdate();
-
NHibernate Pitfalls: Sharing a Session in Multiple Threads
The NHibernate ISession is not thread-safe, that is, it shouldn’t be shared by multiple threads. The ISessionFactory, however, is thread-safe, and thus it should be used to create ISession instances as needed. Do not worry, creating sessions does not mean that connections to the database are immediately open and kept alive, the ISession implementation only opens database connections when they are necessary and closes them when they cease to be.
-
Lesser-Known NHibernate Features: Statistics
NHibernate makes available a number of statistics about its work; this includes, among others:
-
Lesser-Known NHibernate Features: Dynamic Components
NHibernate, unlike others, has lots of ways to map columns from the database to and from classes. Normally, there is a 1:1 relation between columns and properties, but it doesn’t have to be so: there are, for example, components and dynamic components.
-
Lesser-Known NHibernate Features: Calculated Properties
With NHibernate you can have entity properties that are the result of a SQL expression (unlike other O/RMs). It is also possible to add arbitrary SQL restrictions to collections of an entity.
-
Lesser-Known NHibernate Features: Filters
Unlike other OR/Ms – which, as always, shall remain unnamed – NHibernate offers a couple of ways to automatic filter results. Basically, we have two options:
-
Lesser-Known NHibernate Features: Mapping By Convention
Did you know that NHibernate, like other O/RMs out there, allows you to map classes by convention? Yes, it’s true…
Let me show you how!
-
Lesser-Known NHibernate Features: LINQ Extensions
With NHibernate, you are not bound by the out-of-the box methods that LINQ provides, and their default translations to SQL. I already mentioned that you can add your own extension methods, with minimum work:
-
Lesser-Known NHibernate Features: Serializing Configuration
This isn't exactly a feature of NHibernate, but it is something that you can do with it and most people isn't aware of.