Sunday, May 31, 2009

LINQ and Entity Framework Posts for 5/19/2009+

Note: This post is updated daily or more frequently, depending on the availability of new articles.

Updated 5/30 and 5/31/2009 Shawn Wildermuth (Astoria) and Steve Naughton (DD) posts
Updated 5/28 and 5/29/2009
• Updated 5/26 and 5/27/2009
Unmarked initial entries were added 5/25/2009

Entity Framework and Entity Data Model (EF/EDM)

Ayende Rahien contends in his Why Defer Loading in Entity Framework isn’t going to work post of 5/29/2009:

Basically, the EF is going the same way that NHibernate was in NHibernate 1.0 (circa 2005!).

Julie Lerman describes More Designer Improvements - Deleting Entities from the model and from the store schema and lists links to her previous “What’s New in EF 4” posts in this 5/28/2009 post.

Gil Fink’s Entity SQL User-Defined Functions in Entity Framework 4 continues “the tour about the new features in EF4, the next stop is the new user-defined function capability of Entity SQL.”

Faisal Mohamood covers “a few more aspects related to POCO” in his POCO in the Entity Framework : Part 2 – Complex Types, Deferred Loading and Explicit Loading post of 5/28/2009.

• Bob Beauchemin updates the previous post on the topic (see below) with his L2S and EF parameterization problem will be fixed in .NET 4.0 – completely post of 5/26/2009.

• Jim Wooley’s updated ADO.NET Entity Framework Documentation Samples in VB of 5/26/2009 contains links to more VB and C# samples you can download from the MSDN Code Gallery.

• Danny Simmons delivers descriptions of and links to Some Great EF Resources in this 5/25/2009 post.

• Roger Alsing’s Entity Framework 4 – Managing inverse properties of 5/22/2009 says:

It is perfectly possible to do one directional associations in EF4 and POCO mode.
You simply have to manually remove the “ <NavigationProperty ..” tags from your mapping files.

Awesome work EF4 design team :-)

• Naspinski describes Cloning an Entity in Linq-to-Entities in this 5/20/2009 post:

There are a lot of reason you may want to do something like this, for me, users wanted to be able to make a copy of a huge record so they would then be able to go in and change a few things rather than make a whole new record which was very time consuming. At first, I though of pulling the item, manually copying each property, and inserting... but this is programming, there must be a better way.

Matthieu Mezil’s EF4 POCO: my tests post of 5/25/2009 points to an unit tests project to show how POCO works with EF4 and a “BetaBugs test class in order to illustrate the POCO implementation Beta bugs.”

He also takes exception to EF: SQL queries on the same date:

    • With EF4, it’s possible to execute some SQL queries. (It was possible with EF v1 with EF extensions).
    • I don’t like it. Indeed, it implies to break the EDM abstraction against the DataBase.
    • Moreover, we can do without. In the V1, it was possible, with SSDL Functions, to write the SQL query to execute.

Bob Beauchemin claims L2S and EF parameterization problem fixed in .NET 4.0 – almost in this 5/25/2009 post:

In .NET 4.0/VS2010 Beta 1, L2S handles this, producing a VARCHAR(8000) parameter, as SQL Server's autoparameterization does. Entity Framework produces NVARCHAR(4000), fixing the length problem but still using the a different data type than the table specifies.

In my next installment of my MSDN "Under The Table", I'll be writing about the performance implications of data access method code in detail. I do mention "fixed in the next release" WRT L2S and EF, and hope that it will be resolved before .NET 4.0 ships.

Gil Fink describes Calling Database Functions in LINQ to Entities in Entity Framework 4 in this 5/23/2009 post:

Another new feature in EF4 is the new SqlFunctions class. In this post I’ll explain what is SqlFunctions class and how to use it in LINQ to Entities queries.

And Model First in Entity Framework 4 on the same day. His Pluralize or Singularize Generated Object Names Checkbox in Entity Framework 4 and Complex Type Support in the EDM Designer in Entity Framework 4 appeared on 5/22/2009.

Simon Segal’s Entity Framework, Fluent Interfaces & Domain Specific Languages post of 5/23/2009 starts:

I have been giving some thought lately  to how we might go about writing a small internal DSL for reporting on and or editing data in database. Immediately I thought about how LINQ (a DSL in its own right) might play it’s part in this and since we are talking Data, then the Entity Framework came immediately into consideration. Why should we have a DSL for accessing Data? It’s a commonly held opinion that SQL is a DSL for that very purpose, albeit a very general purpose DSL and LINQ is certainly a DSL. …

Alex James wants you to Learn about EF Pluralization Services courtesy of Dan Rigsby in his post of 5/22/2009, which points to WCF Dan Rigsby’s “fantastic in depth post covering our Pluralization Service features.”

Alex’s Tip 21 – How to use the Single() operator – EF 4.0 only post of 5/20/2009 points out that “One thing we’ve added is support for LINQ’s Single() operator.”

And his Tip 20 – How to deal with Fixed Length Keys deals with this issue:

[W]hen you do an insert, padding happens automatically. So for example if you insert ‘12345’ you get 5 spaces automatically appended, to create a string that is 10 characters long.

Check out Alex’s Tip 19 – How to use Optimistic Concurrency with the Entity Framework of 5/19/2009.

Julie Lerman’s “What’s New in EF 4” series consists of the following posts:

Elisa Flasko’s UPDATED WIKI: Home post of 5/22/2009 provides updates to Entity Framework Toolkits & Extensions.

Jim Wooley’s Entity Framework Samples in Visual Basic of 5/21/2009 provides links to the following VB samples for .NET 3.5 SP1 and VS 2008 SPI1 in the MSDN Code Gallery:

Jaroslaw Kowalski announces Entity Framework samples converted to Visual Basic on 5/21/2009.

Faisal Mohamood’s POCO in the Entity Framework: Part 1 - The Experience of 5/21/2009 goes into the details of POCO support in Entity Framework 4.0.

The Entity Framework User Education Team’s Updated Entity Framework Documentation for Beta1 post of 5/21/2009 provides links to and asks for feedback on the following EF4 (v2) topics:

  • Persistence-Ignorant Objects
  • Deferred Loading of Related Objects
  • Functions in LINQ to Entities Queries
  • Customized Object Layer Code Generation
  • Model-First Support
  • Complex Type Support in the Entity Data Model Designer
  • Naming Service
  • Improved Model Browser Functionality
  • User-Defined Functions (Entity SQL)

Danny Simmons’ EF4 Beta 1 now available! and EF4 beta 1 Forums & Docs posts of 5/20/2009 include links for downloading EF4 (v2), its documention, and forum. He also mentions:

Alex James and I sat down [at Tech*Ed] and recorded a short discussion about POCO and other features coming EF4.  Check it out at: http://www.msteched.com/online/view.aspx?tid=ef76e96c-7471-44a6-aa88-1ada037471ca

and Code Sample from my Applied Entity Framework talk at TechEd 2009 now available.

Carl Perry announces Entity Framework 4.0 Beta 1 bits now available in the VS 2010 and .NET 4 Beta 1 on 5/20/2009.

LINQ to SQL

• Steven van Deursen’s Integrating Enterprise Library Validation Application Block with LINQ to SQL and Entity Framework Part 3: The complexity of custom validators. post of 5/28/2009 says:

This article shows the complexity a developer is facing, implementing a custom validator while using an O/RM tool. While the article uses the Validation Application Block and LINQ to SQL in writing the validation logic, the problems encountered in the article are very general.

Jim Wooley’s LinqDataSource and CUD operations with Inheritance post of 5/28 begins:

When I added the Pingbacks and Trackbacks, I changed the implementation of the Comments to use an inheritance model (TPH) where Comments, Trackbacks, and Pingbacks all inherit from the abstract CommentBase class. To refresh your memory, here's the appropriate part of the DBML designer surface:

Comment inheritance model

While this works fine with minimal changes when viewing data, it can cause problems if you are using the LinqDataSource for editing values.

• Fryan Valdez explains What is LINQ to SQL? An Introduction in this 5/25/2009 post.

• Oleg Sych tackles more T4 templates in his T4 Toolbox: LINQ to SQL schema generator - Oleg Sych of 5/19/2009:

Build 9.5 of T4 Toolbox extends the LINQ to SQL generator introduced in version 9.1 with support for database schema generation. This gives you the ability to generate both application code, such as entity and data context classes, and database code, such as table, primary and foreign key scripts, from a single LINQ to SQL dbml file in your solution. Generated database scripts can be automatically added to a VSTS Database project, which will automatically handle majority of database deployment issues by automatically generating the ALTER scripts. In other words, combined with VSTS Database edition, T4 Toolbox  allows you to use model-driven or model-first approach for ongoing development of LINQ to SQL applications.

• Steven van Deursen’s Integrating Enterprise Library Validation Application Block with LINQ to SQL and Entity Framework Part 2: Using context within custom validators. of 5/21/2009 carries this deck:

This article describes how to write custom validators for the Enterprise Library Validation Application Block, in such a way that it runs within the context of a specific LINQ to SQL DataContext or Entity Framework ObjectContext class, which allows analysis of non-persisted (in-memory) changes in that context.

Part 1 of the series is T4 Toolbox: LINQ to SQL schema generator of 5/19/2009.

See Bob Beauchemin’s L2S and EF parameterization problem fixed in .NET 4.0 – almost of 5/25/2009 in the Entity Framework and Entity Data Model (EF/EDM) section.

LINQ to Objects, LINQ to XML, et al.

Graham Neale’s Stretching Lambda’s Legs: Single Statement String Concatenation of 5/28/2009 carries this intro:

Ok, so I wanted to name the title of this post “Simple One Line String Concatenation with Lambda“, but that didn’t happen when I found a few holes in my approach if you wish to omit your concatenation string from being shown at the end (most cases, like with comma-delimited lists).  So, I have offered a solution for both situations, one quite simple when you just wish to concatenate two or more strings, and one more advanced which leaves off your concatenation at the end.

Alex James asks An enumeration of one? on 5/28/2009 and shows you how to create an enumerable object from a single object.

• Damien McGiven asserts XML Linq requires correct namespace for all XElements in this 5/24/2009 post:

I've been teaching myself ASP.Net MVC during any free time I get at the weekends. I started a simple test project which has developed into the events section on NIMTUG. Yesterday I was looking for a way to easily create search engine sitemaps for the event and sepaker pages and I found Robert Tennyson's post Dynamic sitemaps with ASP.NET MVC which seems very easy indeed. With a couple of changes I had the sitemaps working and so submitted them to google only to be notified a couple of hours later that they had failed with the error "Invalid Namespace".

Fabrice Maruerie announces LINQ em Ação, LINQ in Action in Portuguese on 5/20/2009.

ADO.NET Data Services (Astoria)

Shawn Wildermuth shows you how to solve problems Running ADO.NET Data Services 1.5 CTP1 on Windows 7 in this 5/29/2009 post:

I've been running Windows 7 as my primary machine now for a couple of months (first the Beta and now the RC).  I love the OS but there have been a couple of frameworks that didn't work right. The one that perplexes me the most is ADO.NET Data Services 1.5 CTP1.

Phani Raju’s Set Based Operations in Ado.net Data Services Part II post of 5/26/2009 offers:

As an extension to explained in the last blog post dealing with Set based filter operations in our client library we will introduce support for the specifying method calls in the filter expression.

Chris Robinson’s DataSet and Silverlight post of 5/26/2009 states:

There are no plans to add DataSet into future releases of Silverlight. However we are investigating work to bridge existing DataSet investments to new data technologies. Below are three different approaches that can be used to build data-centric applications in Silverlight now.

ADO.NET Data Services is the primary approach to creating data-centric applications in Silverlight. There is a client api within Silverlight for accessing these RESTful Services. ADO.NET Data Services exposes data through ATOM and JSON which are standard technologies when building rich internet applications. Here is a link to get started on this technology: http://msdn.microsoft.com/en-us/data/bb931106.aspx

Shayne Burgess explains Using ADO.NET Data Services v1.5 CTP1 with Visual Studio 2010 Beta 1 in this detailed, illustrated post of 5/22/2009.

Jim Wooley’s Entity Framework Samples in Visual Basic of 5/21/2009 provides links to the following VB sample for .NET 3.5 SP1 and VS 2008 SPI1 in the MSDN Code Gallery: ADO.NET Data Services IUpdateable implementation for Linq to Sql

Eram Nauchum’s ADO.NET Data Services and Silverlight 2 Application Cross-domain Solution post of 5/11/2009 reports:

Recently I followed up the the Astoria blog team and found that they created a great workaround that comes to give a solution for [the cross-domain communications] issue that holt me these days using these data services because my application is distributed and need to be separated for a client and server. Find it here.

ASP.NET Dynamic Data (DD)

Steve Naughton explains Sorting Filters in Dynamic Data (DD v1.0) in this 5/31/2009 post:

This is just a small sample of how to sort your filters in Dynamic Data using the ColumnOrderAttribute from the Dynamic Data Futures project. I was surprised at how easy it was and that I’d not thought of it before.

Steve Naughton shows you how to Move Command Link Column to End Column – Dynamic Data on 5/29/2009:

Whilst answering this question Move Edit, Details, Delete (col 0) to the Rightmost column of table on the Dynamic Data Forum I found this had been answered before (Move GridView command column or dynamically append columns) and decided to post it to my blog in full for easy access.

Steve Naughton’s Password FieldTemplates for Dynamic Data (UPDATED) of 5/21/2009 makes a few minor changes to his prior post on the topic.

His Remembering Page Index when returning to a List Page of 5/15/2009 is a continuation of his earlier Retaining Pager Size in Dynamic Data GridViewPager.

Miscellaneous (WPF, WCF, MVC, Silverlight, etc.)

Chris Robinson’s DataSet and Silverlight post of 5/26/2009 states:

There are no plans to add DataSet into future releases of Silverlight. However we are investigating work to bridge existing DataSet investments to new data technologies. Below are three different approaches that can be used to build data-centric applications in Silverlight now.

ADO.NET Data Services is the primary approach to creating data-centric applications in Silverlight. There is a client api within Silverlight for accessing these RESTful Services. ADO.NET Data Services exposes data through ATOM and JSON which are standard technologies when building rich internet applications. Here is a link to get started on this technology: http://msdn.microsoft.com/en-us/data/bb931106.aspx

Repeated from the ADO.NET Data Services (Astoria) section.

0 comments: