ef4
There are 4 entries for the tag ef4
Thursday, April 22, 2010 11:28 AM | Comments

This post is part of a series on customizing the Entity Framework T4 templates I have been using EF4 for a little while now, and have been taking advantage of the code-generation extensibility afforded to us by T4 templates. This series of posts will describe the enhancements I have made to the default T4 template, and how you can take advantage of this functionality yourself. Part 1 – Generate an IDatabase interface to represent your Data Context Part 2 - Derive entities from a custom base class Part 3 – Suppress Code Analysis warnings from the generated code Protip before we get started Before working with T4, you will absolutely want to install a helpful tool to...

Tuesday, February 9, 2010 9:57 AM | Comments

As a brief recap, the reason this post even exists is because the generated code from the EF4 designer does not properly suppress code analysis warnings. In that post, I mentioned that I would provide a proper T4 template and tutorial on integrating it into your EDMX model. This post details the steps to creating and customizing an Entity Framework 4 T4 template. T4 (the Text Template Transformation Toolkit) is the code generation technology built into Visual Studio. Thankfully, the EF4 designer has been enhanced to support customizable templates so that developers are free to change the code that is generated for your ObjectContext and Entity classes. To get started, I am assuming you already have an EDMX file that has been generated from your database. Beta Note These steps were written for Visual Studio 2010 Beta 2, so they may change slightly before RTM....

Thursday, February 4, 2010 9:32 AM | Comments

Update I have published the instructions and provided a template that can be used to properly suppress code analysis.   Starting a new project opens the doors for some great things. One of those things for me, was adherence to code analysis from the get-go. Visual Studio 2010 in particular has great Code Analysis Rule Set support allowing teams to carefully dictate which rules they wish to apply and suppress. Unfortunately, it wasn’t long before the decision to use Entity Framework 4 put a nice little wrench in my code analysis plan. (As an aside, I will blog more about my decision to use EF4 at a later date -- but long story short, it had to do with the large legacy database that we would be working with). Shortly after loading the existing database into the EDMX and compiling, I was greeted by nearly 1300 code analysis warnings, ranging from naming of properties to...

Wednesday, January 27, 2010 4:45 PM | Comments

Unable to update the EntitySet 'PlanPriceHistory' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation. While I was getting my feet wet in Entity Framework 4 (from the Visual Studio 2010 Beta 2 release), I generated my EDMX from an existing legacy database. All was going well – for a few days in fact, until I attempted to Insert an entity to a specific table (seen below). After some digging around in my model/EDMX configuration thinking something was wrong in there, I decided to open the actual table definition for the EntitySet (‘PlanPriceHistory’) that EF was complaining about. The problem with this particular table is that it logically uses a composite primary key (but was mistakenly not defined as such in the database). The fix was as simple as highlighting the columns and...