P3.NET

DbLimitExpression Exception

Recently I was writing some code for one of my personal projects and I ran across this error in the first Entity Framework call I made – System.ArgumentException ‘DbLimitExpression’ requires a collection argument. Haven’t seen that one before. For anyone running into this issue here’s how I figured it out.

Read More

Entity Framework 6 Conventions

I was incredibly excited when conventions were finally made public in EF6. A convention allows you to set up a policy that a model will follow. For example EF comes with a convention that tables are plural by entities are singular. EF has supported conventions for a while but the necessary public interface was not exposed until EF6. In this post I’m going to walk through creating a simple convention.

Read More

Entity Framework and User Context

Auditing is generally important in most databases because it is important to know who changed data and when. How auditing data is stored depends upon the system requirements but in general the date/time and user who made a change is important. SQL Server already provides the infrastructure to identify the who and what.  Setting up EF to provide this information is straightforward once you know how EF works.  In this post I’ll illustrate a simple approach we’ve been using in web applications for over a year with no issues and very little effort.  

Read More

EF Challenges and Ramblings

I’ve recently been working on a project where I used Entity Framework for the data access.  I’ve run into some challenges that don’t seem to be discussed much in the articles on how to properly use ORM. I’m curious if anyone else is having these challenges. While I’m using EF as my base I’m pretty sure that these challenges exist for other ORMs as well including NHibernate so I don’t believe the challenges to be caused by a specific ORM implementation but rather as a result of using ORMs in general.

Read More