Entity Framework Pitfalls – Concrete Table Inheritance and Identity Keys
When using the Concrete Table Inheritance / Table Per Concrete Type pattern for mapping entity inheritances, you cannot use IDENTITYs as primary keys. It is easy to understand why: because each entity...
View ArticleEntity Framework Pitfalls Index
Updated on August 28thThese are the posts on Entity Framework pitfalls I’ve written so far. This post will be updated whenever there are more.Validation Does Not Load Lazy PropertiesMigrations Require...
View ArticleEntity Framework Pitfalls – Cannot Return Complex Types From SQL Queries
Methods in Entity Framework that return entities from SQL queries, such as DbSet<T>.SqlQuery and ObjectContext.ExecuteStoreQuery, cannot create complex types. This is a known problem, whose...
View ArticleEntity Framework Code First One to One With Cascade Delete
I recently had to figure how to achieve cascade deletes on a one to one mapping. The solution, I soon found out, required fluent configuration.Here’s some simple entities: 1:publicclass Principal 2: {...
View ArticleEntity Framework Pitfalls – Non Nullable Columns in Table Per Class Hierarchy...
When you use the Table Per Class Hierarchy inheritance mapping pattern (Single Table Inheritance in Martin Fowler’s terminology), all properties of derived classes should map to nullable columns in the...
View ArticleEntity Framework Pitfalls – Deleting Detached Entities With Required References
It is common practice in O/RMs to delete an entity without actually loading id, just by knowing its id. This saves one SELECT and is great for performance. For example, using Entity Framework Code...
View ArticleEntity Framework Pitfalls – Null Navigation Properties
What if, after you load an entity, you have a reference property for another entity that is null yet you are sure that it points to a valid record? This will likely be because of one of two things:Lazy...
View ArticleUnity Index
Updated on September 29thMy list of posts on Unity:IntroductionDependency InjectionAspect Oriented ProgrammingExtensionsInjecting Values
View ArticleTracing Entity Framework Code First Calls
Microsoft has published, some time ago, a set of Entity Framework providers, for adding caching and tracing capabilities to Entity Framework. One of these providers, tracing, is now available as a...
View ArticleHijacking ASP.NET Sessions
So, you want to be able to access other user’s session state from the session id, right? Well, I don’t know if you should, but you definitely can do that! Here is an extension method for that purpose....
View ArticleSending Messages to SignalR Hubs from the Outside
IntroductionYou are by now probably familiarized with SignalR, Microsoft’s API for real-time web functionality. This is, in my opinion, one of the greatest products Microsoft has released in recent...
View ArticleDeveloping Windows Store Apps with HTML5 and JavaScript Review
I was asked by Packt Publishing to do a review of their book, Developing Windows Store Apps with HTML5 and JavaScript. I accepted it because it is such a hot topic and I am always interested in new...
View ArticleClient Callbacks In Action Part 1: Auto Completing Text Boxes
I have talked about client callbacks in the past, and even provided a general-purpose control for invoking code on the server-side. This time, I will provide two more examples:A text box control that...
View ArticleI’m An Old School Guy
Yes, in 2014, I am still talking about ASP.NET Web Forms instead of MVC, Web API, SignalR and OWIN! It’s not that I am unaware of these technologies – in fact, I do like and wrote some things about...
View ArticleFuture Posts
So, a new year is upon us. As part of my new year’s resolutions, I decided to keep on blogging, and, what deserves more attention that what I already started?Well, it just happens that I have a number...
View ArticleDelete By Id in NHibernate
NHibernate allows executable queries, that is, plain old UPDATEs, INSERTs and DELETEs. This is great, for example, for deleting an entity by its id without actually loading it. Note, that the following...
View ArticleClient Callbacks in Action Part 2 : Self-filling Drop Down List
On the first part of this two-post series I presented a text box that has the ability to suggest values, after a number of characters has been entered. It does this by leveraging the client callbacks...
View ArticleMinimum NHibernate Code
Sometimes people complain that NHibernate is difficult. Although NHibernate offers a lot of options when compared with other O/RMs, I don’t fully agree with this. Just as an example, all that it takes...
View ArticleNHibernate Pitfalls: Table Schema
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.NHibernate has a schema attribute on HBM XML mappings and a Schema() method on fluent configuration that...
View ArticleOn NHibernate Performance
I noticed a flaw here. Will update the numbers in the next days.IntroductionEvery once in a while, someone comes up with a benchmark comparing O/RM tools. This time, it was my friendly neighbor at...
View Article