Saturday, October 03, 2009

LINQ and Entity Framework Posts for 9/28/2009+

Note: This post is updated weekly or more frequently, depending on the availability of new articles. (This was a poor news week in the LINQ and EF categories.)

Entity Framework and Entity Data Model (EF/EDM)

Devio delivers the Structure and Analysis of edmx Files (1) on 10/2/2009:

The Entity Designer of Visual Studio 2008 stores its data in an XML file with the extension .edmx.

The file contains the Storage Model, the Conceptual Model, and Mappings between both models, and also layout information of the diagram. (The inclusion of layout data in a model file is really a conceptual mess). …

He continues with a lengthy description of the namespaces and hierarchy involved.

Gil Fink’s ADO.NET Entity Framework Session [at] Microsoft post of 10/1/2009 announces:

A few months ago I wrote about a session I’m suppose[d] to do on ADO.NET Entity Framework at Microsoft Israel. This is a reminder for that session which will take place on October 19 at Microsoft Ra’anana.

In the session I’ll introduce Entity Framework and talk about how to use it. I’m also going to dedicate the end of the session for EF4 and show some of the features it include like POCO, Model-Defined Functions and more. If you are interested to hear about Entity Framework this is the place to be. You can sign in to it from here.

Julie Lerman’s What's New in Entity Framework 4 at SSdotNET (Olympia WA) Oct 8th post of 9/30/2009 says:

I'm very happy that I'll be speaking at the Olympia, Washington's South Sound .NET User Group next Thursday night (October 8th).

I will be showing off some of the great new features of Entity Framework  coming in Visual Studio 2010.

This was a last minute trip out west, so thanks to group leaders (and my buddies) Paul Mehner and Camey Combs, and especially to Jeff Olsen who was origianlly schedule to present taht night, for their flexibility. I had planned to attend the meeting anyway but am happy I'll be able to show off EF4 to this very fun group.

Julie Lerman observes on 9/29/2009 that ObjectContext.SaveChanges is now Virtual/Overridable in EF4:

Last summer, I asked this question in a thread in the MSDN forums:

So is there anyway to completely override savechanges - just replace it with your own code if for some reason you wanted to?

The answer was no.

As I am digging deeper and deeper into EF4 while I write the 2nd edition of Programming Entity Framework, I learned that the answer has changed to yes!

Visual Basic 
Public Overridable Function SaveChanges ( _
    options As SaveOptions _
) As Integer

C# 
public virtual int SaveChanges(
    SaveOptions options
)

This is not a capability to take lightly. If you peek into the SaveChanges method in Reflector, there’s a lot of logic you want to consider.

The provider (e.g. SqlClient) does most of the grunt work through the Update method of the IEntityAdapter interface.

SaveChanges wraps that with transactions and connections etc. So you could completely rethink how this works or plug in your own framework logic.

It is another door opening very widely on the possibilities of EF’s extensibility. …

LINQ to SQL

No articles of significance in this category found for the week.

LINQ to Objects, LINQ to XML, et al.

Fabrice Marguerie announces in his New LINQ tools category on SharpToolbox.com post of 10/3/2008:

I've just moved the LINQ tools referenced on SharpToolbox.com to a new dedicated LINQ category.

20 tools and providers are listed for the moment. I'll add more shortly.

See Jim [Wooley]'s blog for more resources.

Jim Wooley recommends that you Watch language differences when parsing Expression Trees in this 9/28/2009 post:

I’ve run into a number of cases where people have built LINQ providers and only tested them with C# clients. In one case, I was sitting next to the person who wrote the provider when we discovered that using a VB client didn’t work with their provider because they failed to test it.

I’ve even seen it in the sample Entity Framework provider  available on the MSDN Code Gallery when parsing the .Include() method. Hopefully, you will be able to access my VB translation of the EF sample provider once it finishes going through the legal hoops.

So, why are these providers failing when run against a different language? Much of LINQ is based around language syntactic sugar. The various compiler teams added different optimizations when translating your LINQ code into real framework code. (Update: the VB Team explained the difference in a blog post from 2 years ago.) …

Jim continues with a code sample.

Rupert Bates shows you how to implement Group By with Count in Linq in this 9/29/2009 post:

To group a sequence getting a count for each element of the grouped sequence using Linq:

var wordList = new List<String> { "test", "one", "test", "two" };

var grouped = wordList

    .GroupBy(i => i) //Group the words

    .Select(i => new { Word = i.Key, Count = i.Count() }); //get a count for each

and includes a screen capture of the result. …

ADO.NET Data Services (Astoria)

No articles of significance in this category found for the week. 

ASP.NET Dynamic Data (DD)

Rick Anderson’s Client Side Validation for MVC 2 P2 shows you how to add client-side data validation with one line of code:

The following images displays client side error messages. Notice the validation summary is empty, the validation summary occurs on the server side. You can correct the email alias (a@bb.com for example) and it will instantly remove the validation error, even before you tab out of the input control.

The following images displays client side error messages. Notice the validation summary is empty, the validation summary occurs on the server side. You can correct the email alias (a@bb.com for example) and it will instantly remove the validation error, even before you tab out of the input control.

blog comments powered by Disqus