One framework to rule us all…

Archive for the ‘Entity Framework’ Category

Entity Framework 4.1: Resources and What’s New

Microsoft released today the Release to Web (RTW) of Microsoft ADO.NET Entity Framework 4.1 (EF 4.1). For those who don’t know, the ADO.NET Entity Framework enables developers to create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema. The goal is to decrease the amount of code and maintenance required for data-oriented applications. What’s in EF 4.1? ADO.NET Entity Framework 4.1 introduces two new features: The DbContext API is a simplified abstraction over ObjectContext and a number of other types that were included in previous releases of the ADO.NET Entity […]

Read more

ADO.Net Entity Framework CTP Released

The EF team announced today the release (and availability of course) of Entity Framework CTP 2. The updated includes many requested improvements and features, and supports installation with Visual Studio 2010 Beta 2. Some of the improvements and added features added since the last CTP include: Enhancements to Code Only, including: Fine Grained Control over model Specify Navigation Property Inverses Specify Property Facets Complex Types Customizable Mappings Change Table Name, Column Names Specify Custom Inheritance Strategy Entity Splitting Join Table Mapping The Self-Tracking Entities template, allowing code generation of EF entities that facilitate ease of use in WCF/N-Tier scenarios- Foreign […]

Read more

Entity Framework RTM and Beta changes

There were a number of changes to the Entity Framework and the UI designer between Visual Studio 2008 SP1/ .NET Framework 3.5 Beta and the RTM that require updates to existing source code. These breaking changes are listed below, courtesy of the ADO.NET teamblog. These include the mitigation for adjusting to the new behavior, and a side by side comparison of Beta code and RTM code. Provider Changes 1. The Function property of DbFunctionCommandTree is renamed to EdmFunction. Affects:        – Provider writersMitigation:        – Replace “.Function” wtih “.EdmFunction” SP1 Beta Code:

SP1 RTM Code:

2. DbExpression, DbAggregate […]

Read more

Performance optimization with CompiledQuery

During a programmer’s lifetime, a top priority when developing new software is performance. New architecture is good, new technologies are good, but lets not be hasty: in this domain, “easier” and “new” sometimes leads to “slower”. With this in mind, I’ve been recently investigating the Entity Framework general performance when performing queries against a database, whether by using Linq or Entity SQL. So I’ve come across the CompiledQuery class. This class allows us to cache an Entity Query and reuse it in the following requests in order to increase query execution speed from there on. Its usage is as it follows: IQueryable list;

So basically what […]

Read more

How to duplicate Entity Framework objects

I’ve recently come across a problem that I thought it would be simple to solve by using Entity Framework. I wanted  to duplicate an object  to make things easier for me and, ultimately, to the user, but I guess my assumption was incorrect. After some tests with reflection, google searches and a lot or brainstorming I’ve reached the conclusion that in Entity Framework there isn’t a built-in or clear method that allows developers to clone objects and then persist the newly created object with some changes.  You’ve probably tried to clear EntityKeysValue members and got the readonly exception right? – EntityKey values cannot […]

Read more

Entity Framework 2.0 development starts today

The Entity Framework team is starting, from today, to develop the new Entity Framework v2.0. They will be posting design notes, pattern and architecture discussions every time there’s something to be decided, so that everyone’s opinion and insight can be taken into consideration and everyone can contribute to achieve the best Framework possible, considering every real world scenario. Their blog already has its first post and there’s more to come. So, in order to be a alongside the project development and even be “part of project”, stay tuned with this blog.

Read more

Paging with the ADO.NET Entity Framework

In the ADO.NET Entity Framework, row paging can be done quite easilly by (once again) applying clauses to your query or builder methods to your IQueryable object. By using the Skip query method (that corresponds to the Entity SQL Skip sub-clause), you can pass out a predetermined number of rows to position the internal DBMS cursor over the target recordset, and by using the Top query method (corresponding to the Entity SQL LIMIT sub-clause), you can restrict the number of rows fetched from there.  However, in Entity SQL, SKIP and LIMT cannot be used without the ORDER BY statement and as such, you will see that there’s […]

Read more

Dynamic Entity property search using Expressions

I’ve been recently working on a nifty project in wich the primary purpose is to search for media data in the database. It’s a normal ASP.NET application, based on the 3.5 version of the .NET framework – nothing new here. The great news is the Linq to Entities platform I’m building it on. This is indeed a very usefull technology and this is my first project using Linq to Entities. This is the scenario: We have objects, and objects have properties. The goal of this article is to be able to search the storage for objects by using a global text search affecting their properties. I will give this […]

Read more

How to check for an entity object’s EntityKey properties

In an Entity Framework enviroment, the generated EDM (Entity Data Model) provides us with all the information we need to map our database schema. (In fact, that isn’t entirely true. Unfortunately default values aren’t mapped into its relative objects. But since that’s not the issue here, I’ll adress that in a later post). Whenever you need, you can check each of your Entity object’s properties and attributes in order to find its schema on your database. One common question in the Entity Framework community is: How do I get all the primary keys of an Entity Object (EntityKey’s). Well, the answer is simple: all […]

Read more