NHibernate Pitfalls: Making Changes to the Configuration After the Session...
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.You shouldn’t be making changes to the configuration instance after the session factory is built, because it...
View ArticleSoft Deletes With NHibernate
Updated: thanks, AdamSometimes we are not allowed to physically delete records from a database. This may be because of some policy, legal obligations, traceability, or whatever. It is sometimes called...
View ArticleAttaching Disconnected Entities in NHibernate Without Going to the Database
Because the SaveOrUpdateCopy method of ISession is marked as obsolete, we no longer have an API method that allows us to attach a disconnected entity (meaning: coming from a session that no longer...
View ArticleSoft Deletes With NHibernate, Part II
After my previous post, Adam Bar suggested that setting an SQL Delete command might be a better idea, I actually agree with him, so I decided to post an alternative solution.For those not familiar with...
View ArticleStrongly Typed Routes for ASP.NET MVC
OK, I know there are already a number of these, but since I didn’t actually know any, I wrote my own library.I was trying to achieve something like this in a simple way: 1: RouteTable.Routes 2:...
View ArticleNHibernate Pitfalls: Non Nullable Columns in Table Per Class Hierarchy...
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.When you use the Table Per Class Hierarchy inheritance mapping pattern (Single Table Inheritance in Martin...
View ArticleCustom LINQ Extensions for NHibernate
With extensibility virtually everywhere, NHibernate is nice to work with! Consider, for example, a need to call a database-specific function in a LINQ query – a typical request.In SQL Server there is...
View ArticleNHibernate Pitfalls: Take and Where Order in LINQ Queries
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.Starting with NHibernate 3.3.3, the order by which the Take and Where operators are placed on a LINQ query...
View ArticleNHibernate Pitfalls: DateTime Type Loses Milliseconds
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.By default, when you have a mapped DateTime property on an entity, if you don’t specify any type, NHibernate...
View ArticleASP.NET Web Forms Extensibility: Handlers
In the .NET world, all HTTP requests, whether they be for web services (XML, WCF, Web API), pages (Web Forms and MVC), etc, are processed by a handler. Basically, a handler is a particular...
View ArticleExtended ASP.NET Button Control
I once had the need to have a button control that would change its look depending on a theme, for example, it would render either as regular button, an image or a link. Of course, the only way I had to...
View ArticleNHibernate Pitfalls: Collections of Elements and Inverse
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.When mapping a collection of elements, this collection should not be marked as inverse. This is a different...
View ArticleUnity - Part 1: Introduction
IntroductionUnity is Microsoft’s Inversion of Control (IoC) and Dependency Injection (DI) container. It is part of the Enterprise Library family of Application Blocks.I have been using it for years....
View ArticleUnity – Part 2: Dependency Injection
Dependency InjectionSecond part of my series on Unity. For an introduction, read the first post.OK, now we know how to get Inversion of Control (IoC): instead of referencing a particular concrete...
View ArticleUnity – Part 3: Aspect Oriented Programming
AOPThis is my third post on Unity. See the first here for an introduction and the second here for how to apply dependency injection.Aspect Oriented Programming (AOP) is a technique for applying...
View ArticleEntity Framework Code First Relations
IntroductionThis post is more for self-reference than anything else. Basically, I tend to forget some options for mapping relations with Entity Framework Code First, so I wrote this. If in doing so it...
View ArticleEntity Framework Code First Inheritance
IntroductionAnother post for self reference, this time, how to map inheritance strategies with Entity Framework Code First.Single Table Inheritance / Table Per Class HierarchyFirst, the default...
View ArticleVisual Studio 2012 and .NET 4.5 Expert Development Cookbook Review
Visual Studio 2012 and .NET 4.5 Expert Development Cookbook I recently started reading Packt Publishing’s Visual Studio 2012 and .NET 4.5 Expert Development Cookbook. It is a book focused primarily on...
View ArticleQuerying Entity Framework Code First Inheritance
This is a short post to complement my previous one on Entity Framework Code First Inheritance: how to query for a specific class. The options are:From the DbContext collection: 1:...
View ArticleFilter Collections Automatically With Entity Framework Code First
IntroductionIn some O/RMs, it is possible to specify automatic filters for entity collections such as one-to-many or many-to-many. These are applied automatically whenever these collections are being...
View Article