Archives
-
Entity Framework Pitfalls: Command Interceptors and Identity Keys
The IDbCommandInterceptor (sorry, no official documentation) interface was introduced in Entity Framework 6 as part of the new interception and logging API, and allows the interception of the SQL and its parameters that are sent to the database as the result of DbContext CRUD operations.
-
SQL Server Auditing
Probably the best mechanism for auditing changes to tables in SQL Server is Change Data Capture, which I already covered here. Unfortunately, it only works with the Enterprise editions of SQL Server, something that not everyone has access to.
-
Custom Entity Framework Code First Convention for Discriminator Values
Since version 6, Entity Framework Code First allows the injection of custom conventions. These conventions define rules that will be applied by default to all mapped entities and properties, unless explicitly changed.
-
Entity Framework Pitfalls: Mapping Discriminator Columns
When you use a discriminator column, that is, a column that holds a value that tells Entity Framework what type the row refers to, or what restriction it shall use when querying the entity, you cannot map this column as a property in your entity.
-
Lesser-Known NHibernate Features: Result Transformers
A result transformer, in NHibernate, is some class that implements the IResultTransformer interface:
-
Getting the SQL for HQL and Criteria Queries
OK, so, I already showed how we can get the SQL that was generated from a LINQ query. Of course, we can do the same for both HQL and Criteria APIs as well (QueryOver is just a wrapper around Criteria, mind you).
-
Adding Support for ISupportInitialize in NHibernate
The .NET ISupportInitialize interface is used when we want to support staged initialization for objects. Its BeginInit method is called when initialization is about to start and EndInit when it is finished.
-
Lesser-Known NHibernate Features – Generating Database Scripts
As you may know, NHibernate knows how to generate the database for you from its model. Any of the supported databases will do.
-
Unity, Part 9: Integration With Managed Extensibility Framework
This time, I will be talking about integrating Unity with Managed Extensibility Framework (MEF). You can find the other posts in the series here (how to use Unity in a web application), here (adding Interfaces), here (registration by convention), here (injecting values), here (extensions), here (aspect-oriented programming), here (dependency injection) and the first one here (introduction).
-
ASP.NET Web Forms Prompt Validator
For those still using Web Forms and Microsoft’s validation framework, like yours truly - and I know you’re out there! -, it is very easy to implement custom validation by leveraging the CustomValidator control. It allows us to specify both a client-side validation JavaScript function and a server-side validation event handler.
-
NHibernate Pitfalls: Versioned Entities Are Not Batcheable
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
My MVP Blog
I started cross posting to my MVP blog, but you can continue following just this one because it will always be updated.
-
Generating GDI+ Images for the Web
.NET’s Graphics Device Interface (GDI+) is Microsoft’s .NET wrapper around the native Win32 graphics API. It is used in Windows desktop applications to generate and manipulate images and graphical contexts, like those of Windows controls. It works through a set of operations like DrawString, DrawRectangle, etc, exposed by a Graphics instance, representing a graphical context and it is well known by advanced component developers. Alas, it is rarely used in web applications, because these mainly consist of HTML, but it is possible to use them. Let’s see how.