Showing posts with label LINQ to Mock. Show all posts
Showing posts with label LINQ to Mock. Show all posts

Tuesday, May 27, 2008

LINQ and Entity Framework Posts for 5/22/2008+

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

SQL Server Data Services Rolls Out "Sprint 2" Upgrade

The SQL Server Data Services (SSDS) team's Sprint 2 goes live post of May 26, 2008 announces the second upgrade to SSDS servers were completed last week. Here's their list of new or improved features:

  • Full text index and search
  • Multiple B-Trees - this will allow us to deploy schemas as we move toward supporting schemas in SSDS
  • Asynch queries - this will help in exposing fanout queries across multiple containers
  • Logging and tracing improvements to help us manage and debug the service efficiently
  • Backup and restore services
  • Improvements to our Distributed Data Fabric for failover and friendly swapping between primary and secondary partitions

Hopefully, documentation for using the new features will appear quicker than that for SSDS v1.

Added: May 27, 2008

Steve Naughton Completes His Five-Part Permission Solution for ASP.NET Dynamic Data

UK Web developer Stephen Naughton has completed a five-part tutorial for adding role-based permissions to an ASP.NET Dynamic Data project on May 26, 2008:

  • Introduction - A DynamicData Attribute Based Permission Solution using User Roles.
  • Part 1 - Permissions Attribute (Metadata) Classes.
  • Part 2 - Sample Metadata for project.
  • Part 3 - The Helper Extension Methods.
  • Part 4 - Limit Tables shown on Default page and List, Edit & Details etc.
  • Part 5 - Generate Columns/Rows (using IAutoFieldGenerator)

    Following are two earlier posts on Dynamic Data topics:

  • DynamicData - Limit the Filter Fields
  • DynamicData - Automatic Column Update

    The ASP.NET Dynamic Data team's David Ebbo thanks Steve for his contribution in his Sample: Dynamic Data and attribute based permissions post of 5/7/2008.

    Added: May 27, 2008, Updated: May 27, 2008

    David Ebbo Explains How to Disambiguate ASP.NET Dynamic Data's PageRequestManagerServerErrorException JavaScript Error

    ASP.NET Dynamic Data turns on AJAX partial rendering using an UpdatePanel by default, which substitutes PageRequestManagerServerErrorException errors for more informative messages. In his Dynamic Data, AJAX and JavaScript errors post of May 25, 2008, David explains how to turn off partial rendering (open the Site.master file (at the root of the app) and set EnablePartialRendering="false") so you can see the real error message.

    Added: May 27, 2008

    ADO.NET Entity Framework v2 Wish List Started in MSDN Forum

    If you want to influence the feature list for the next version of the Entity Framework (EF), now's the time to add your request to the v2 Wish Lists - Add Yours Here thread that John Papa started in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum. As of May 27, 2008 there were 13 replies in the thread.

    Added: May 27, 2008

    Diego Vega Explains How the EntityDataSource DataBinds Complex Types to ASP.NET Server Controls

    Diego's EntityDataSource's flattening of complex type properties post of May 24, 2008 is an expansion of the answer he give Julie Lerman in response to her Re: DataBinding Complex Type properties question of the same date in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum. This post is an expansion of Diego's earlier EntityDataSource: To wrap or not to wrap post of May 13, 2008.

    In short, the EntityDataSource (EDS) flattens complex properties to enable two-way databinding to ASP.NET controls with Eval("Address.Street"), DataField = "Address.Street" and Bind("Address.Street") methods. An exception is one-way binding to ComboBoxes which requires an explicit projection with an alias, such as Select ContactID, Address.Street As Street.

    Added: May 24, 2008

    Francois Vanderseypen Explains Why He Didn't Use Entity Framework in his Sample Project

    In his Linq To Sql or Entity Framework? post of May 24, 2008 Francois says he decided not to use Entity Framework for the Northwind Factory v2.1 sample project for the following reasons:

    It seems Microsoft had the intention to ship the EF with VS2008 but a lack of time forced them to drop it and it’s now planned for SP1. Still even at this SP1-beta stage it’s somehow unacceptable that the multi-tiered solution, which should be there out of the box, is not present. Neither in L2S nor in the EF. It’s unacceptable for me in the sense that the whole world is now gravitating around multi-layered applications and any ORM or DAL system should enable this scenario (No out-of-the-box story!).

    EF appears to me to be closer to a Microsoft multi-tiered implementation than LINQ to SQL because it serializes complete object graphs with the updated SP1 DataContractSerializer (DCS). Danny Simmons demonstrated the feasibility of a multi-tier EF with the Perseus project and its EntityBag. The question now is whether Danny intends to rearchitect Perseus with DCS or stick with EntityBag.

    Added: May 24, 2008

    Dinesh Kulkarni on Object Tracking and LINQ to SQL DataContext Lifetime

    Dinesh explains that LINQ to SQL's object (instance) tracking feature is intended to prevent entities returned by successive queries from "stomping" on cached entity values. In his LINQ to SQL Tips 6: How to refresh given DataContext won't stomp on your objects post of May 23, 2008, Dinesh notes that you can overwrite the current values of one or more specified entities with the DataContext.Refresh method. However, he cautions that "the changes in the database for a given query can be:

      1. Newly inserted objects
      2. Updates of existing objects
      3. Deleted objects that were present in a previous execution of the same query

    Issuing the same query with the same DataContext takes care of the first. Refresh() can handle #2. But #3 requires a little more thought and computation. You could certainly use another DataContext to compare results."

    The issue resolves to selecting the appropriate DataContext lifetime, as recommended in his Lifetime of a LINQ to SQL DataContext post of April 27, 2008. If your application is stateful, consider separate DataContexts for online transaction processing (OLTP) and reference data. Dinesh's recommendations also apply to projects that use the Entity Framework.

    Added: May 24, 2008

    Rob Conery Completes MVC Storefront Parts 11 and 12 with Moq and Jimmy Bogard Proposes an nHibernate Fork 

    Rob's MVC Storefront, Part 11: Hooking Up The Shopping Cart And Components and MVC Storefront, Part 12: Mocking of May 23, 2008 continue the MVC Storefront saga. Part 12 uses Moq (a.k.a. LINQ for Mocks) to mock the repository's authentication data (Email, UserID, and Password).

    Rob acknowledges in Part 12 Jimmy Bogard's proposal in The MVC Storefront Challenge! post of May 20, 2008 to fork the code with nHibernate replacing LINQ to SQL. The comments include responses from several potential volunteers to help with the coding.

    Added: May 24, 2008

    Test Google Sites LINQ and Entity Framework Wiki Started

    I needed a place to catalog links to LINQ and Entity Framework resources, such as magazine articles, online help pages, and blog posts, that aren't date-sensitive. Google Sites opened as a free service to the public this week, so I set up a LINQ-EF site with pages of "announcements" for LINQ and EF-related topics. The LINQ-EF site isn't meant to compete with Troy Magennis's Hooked on LINQ Wiki; it doesn't include any original content.

    Google Sites is based on the JotSpot model but with many advanced JotSpot features missing. (Google acquired JotSpot in late October 2006.) It's simple to set up and navigate, and it substitutes an HTML editor for the arcane markup used by many wikis. It doesn't yet integrate with other Google Apps. It's certainly not the "SharePoint" killer that some bloggers claim, but it's probably good enough for my current needs.

    Added: May 24, 2008

    Dates, Times and Codes Added to Most Tech*Ed LINQ and Entity Framework Sessions

    The LINQ and Entity Framework Breakout and TLC Sessions at Tech*Ed Developers 2008 post was updated May 23, 2008 to include date, time and code data from the ADO.NET Team's Going to TechEd? Drop by and say Hi! blog of the same date.

    Apparently, only Tech*Ed 2008 Developer attendees have access to this added data.

    Added: May 24, 2008

    Has LINQ to SQL Reached Legacy Status Less than Three Months after Launch?

    LINQ to SQL was the only new data-access implementation to be included in Visual Studio 2008 when it "launched" with SQL Server 2008 and Windows Server 2008 in a series of "Heroes Happen Here" extravaganzas that started on February 27, 2008.

    Judging from my Is the ADO.NET Team Abandoning LINQ to SQL? post of May 21, 2008, Microsoft appears to have ceased further development of LINQ to SQL, based on the lack of new and promised features in the LINQ to SQL SP1 Beta.

    Repeated from: LINQ and Entity Framework Posts for 5/19/2008+

    Updated 5/23/2008 with a response to a comment from Andres Aguiar and Julie Lerman's Damien Guard joins the LINQ to SQL team as a developer post of the same date.

    Quick Links to VS 2008 SP1 Beta Docs

    My VS 2008 and .NET Framework 3.5 SP1 Beta Documentation and Forum Links of May 22, 2008 has links to LINQ, Entity Framework and related topics in the unsearchable (and unindexed) MSDN Library.

    Marcin Dobosz on Customizing ASP.NET Dynamic Data Validation Metadata

    Marcin's Dynamic Data samples: Custom metadata providers post of May 23, 2008 explains how to "programmatically add [data validation] metadata attributes to an in-memory store before you register your model with the Dynamic Data runtime in Global.asax." This sample replaces the XML-based metadata provider for the December 2007 CTP.

    His earlier Dynamic Data samples post contains a list of the current and forthcoming ASP.NET Dynamic Data samples. (I added a "Where's the beef?" comment to this post.)

    A Solution for the KB944899 Problem When Attempting to Install VS 2008 SP1 Beta

    Wally McClure found the Visual Studio 2008 Hotfix Cleanup Utility on the MSDN Code Gallery. This small *.exe file removes KB944899, if present, and removes the registry keys that cause the problem.

    Matt Manela Explains LINQ to SQL's Optimistic Concurrency Management Features

    In his Intro to LINQ to SQL Optimistic Concurrency post of May 22, 2008, Matt explains the significance of the UpdateCheck.Always, UpdateCheck.Never, and UpdateCheck.WhenChanged properties when managing updates with optimistic concurrency conflicts.

    Scott Allen Analyzes Rob Conery's Problems with LINQ to SQL Lazy Loading

    Scott left a comment to my "Rob Conery Runs into a LINQ to SQL Corner with his Repository Model" topic of LINQ and Entity Framework Posts for 5/19/2008+ that Rob's conclusion it was LINQ to SQL's fault: "I'd say that requires more investigation. Doesn't sound correct."

    His Rob's Not So Lazy MVC Storefront post of May 21, 2008 uncovers the real culprit, a type conversion of the IList<Product> property.

    Kevin Lewis Rewrites His UPS Webservice Rate Calculator with LINQ to XML and VB Literals

    His LINQ to UPS to Calculate Shipping Rates post of May 22, 2008 contains the full source code for his updated GetShippingMethodsFromWeb function.

    Samir Bajaj Demonstrates How to Use LINQ to SQL with Table per Type Inheritance

    From the How Did I Miss That? department: Back on April 2, 2008, Samir posted TPT with LINQ to SQL on his MSDN blog that I wasn't tracking at the time. He discusses the three common mapping strategies for object hierarchies: Table per Hierarchy (TPH), Type per Type (TPT) and Table per Concrete Type (TPCT). LINQ to SQL has out-of-the-box support for TPH only. But Samir demonstrates that you can map a TPT hierarchy "using the built-in TPH support and a bit of T-SQL code."

    The sample code is available here: TPT with LINQ to SQL.

    Marco De Sanctis Asserts That It's Not Always a Wise Choice to Eager-Load Associated Entities in LINQ to SQL Projects

    Most developers using LINQ to SQL as the data layer eager-load associated entities to minimize round trips to the database. In When Lazy Loading associations is useful of May 22, 2008, Marco describes two scenarios where lazy loading may be beneficial.

    Marco De Sanctis Wraps LINQ to SQL's Data Context in a Generic Unit of Work Instance for Caching by ASP.NET

    His Linq To Sql in real word Web applications post of May 20, 2008 shows you how to wrap LINQ to SQL's Data Context in a generic Unit of Work instance to emulate nHibernate's SessionPerConversation pattern. His post includes a link to download the sample code.

  • Friday, April 04, 2008

    LINQ and Entity Framework Posts for 4/3/2008+

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

    John Papa Writes Yet Another Article on LINQ Query Operators

    John's Standard Query Operators with LINQ post of April 5, 2008 points to his eponymous article for his "Data Points" column in MSDN Magazine. I thought the market for magazine articles that demo the Standard Query Operators with arrays of numbers and Northwind entities was saturated. Obviously I was wrong.

    Added: 4/6/2008

    Rumor: Google to Compete Against SimpleDB and SSDS with Bigtable as a Web Service

    TechCrunch blogger Mark Hendrickson relies on "a source with knowledge of the launch" to report rumors about Google opening Bigtable to developers in his Source: Google To Launch BigTable As Web Service post of April 4, 2008. Mark says the announcement is scheduled for the week of April 6.

    Dave Winer must have had premonitions of the possible event when he wrote a pair of prescient posts that I quote in my Rumor: Google to Compete with SimpleDB and SSDS with Bigtable as a Web Service post of April 5, 2008.

    My conclusion: Bigtable's architecture and implementation have more in common with Amazon's Simple DB than either database has with SSDS:

    • Bigtable and SimpleDB aren't relational database management systems (RDBMSs); both resemble multidimensional indexed maps of attribute/value pairs. SSDS attempts to hide the fact that it's an RDBMS.
    • Bigtable and SimpleDB have latency, which results in eventual consistency, although it appears from Table 2 of the Bigtable technical paper that no-latency operation is an option; SSDS has no latency by design.
    • Bigtable values are an "uninterpreted array of bytes" and SimpleDB stores only strings; SSDS has string, number, datetime, binary and boolean datatypes.

    Added: 4/5/2008

    Updated: 4/6/2008

    Randolph Cabral Compares ActiveRecord and Unit of Work Patterns with LINQ to SQL

    Randolph's Active Record Vs. Unit of Work post of April 3, 2008 is an essay on the relative merits of and problems with the two design patterns. He cites cardinality issues with updates to associated entities as an Active Record problem. The additional code required to reattach detached objects with LINQ to SQL in Web applications is the major hurdle with the Unit of Work pattern.

    Added: 4/5/2008

    Julie Lerman Finds Anomaly in the EDM Designer's Update Model from Database Feature

    Julie describes in her  EF UpdateModel and naming conflicts post of April 5, 2008 the agonies of creating entities in the EDM Designer, then adding tables for them to a persistence database, and trying to use the Update Model from Database feature to hook the model to the store. In this case, a table and association with identical names blocked the update.

    Julie reports that she gave up on the process of updating a simple model from an existing database in her Model first with EDM? post a few hours later.

    A message by a member of the ADO.NET team in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum, which I no longer can find, mentioned that the team was working on a separate application to create a (presumably SQL Server-only) database from an EDM. This is good news.

    However, Julie was attempting to define a CSDL file that can be used with multiple sets of SSDL and MSL files to accommodate different back end databases, so building the database from the model wouldn't appear to solve her problem.

    Added: 4/5/2008

    Update 4/6/2008: Julie added the following in a comment at the end of the post: "I actually had some success with the model first tests and updated my blog post."

    Emad Ibrahim Creates a LINQ to SQL Unit Test with LINQ to Mock (Moq)

    Emad's Unit Test Linq to Sql in ASP.Net MVC with Moq post of April 4, 2008 shows how he:

      1. Modified the Moq version of the MvcMockHelpers class from Scott Hanselman and added two more methods to mock an authenticated user
      2. Added a couple of properties to [the] test class (MessageControllerTest) to make it easy ... to access the controller and view engine in all the test methods
      3. Created [a] test method which is going to call a Create method in [the] MessageController and pass it a string.

    His post also include links to related resources.

    Added: 4/4/2008

    Julie Lerman Posts Eight Entity Framework Tutorials on DataDeveloper.net

    In addition to writing her book, Julie found time to write eight Entity Framework tutorials. Here's the list with links:

    1. 101 Tutorial:Creating an ADO.NET Entity Framework Entity Data Model
    2. 101 Tutorial: Use an Entity Framework Entity as a WinForms Data Source
    3. 101 Tutorial: ASP.NET DataBinding with the Entity Framework
    4. 101 Tutorials: WPF Databinding with Entity Framework
    5. Many to Many Relationships in the Entity Data Model
    6. Using Stored Procedures for Insert, Update & Delete in an Entity Data Model
    7. Naming conventions in an Entity Data Model: Cleaning up the wizard-generated EDM
    8. Adding items to a LINQ Query of anonymous types - after the fact

    Julie says in her Eight Entity Framework Tutorials on DataDeveloper.NET post of April 4, 2008 that the "'101 Tutorials'" are designed to make sure new programmers don't get completely lost."

    Added: 4/4/2008

    Jesse Liberty: Send LINQ to SQL Data via WCF to a WPF DataGrid in a Silverlight 2.0 Project

    The Silverlight.net site's Displaying SQL Database Data in a DataGrid using LINQ and WCF post of April 4, 2008 is a detailed, fully illustrated tutorial for integrating LINQ to SQL, Windows Communication Foundation (WCF) asynchronous service calls, and the new Windows Presentation Foundation (WPF) DataGrid in a Silverlight 2.0 Beta 1 project.

    Here are Jesse's links to the source code and a version of the tutorial in PDF.

    According to the tutorial's introduction:

    The application we’ll build will combine a number of different new skills:

    • Connecting [asynchronously] to a WCF Web Service
    • Using LINQ to query and retrieve data that our Silverlight Application can use
    • Using the DataGrid control to display data

    From a strictly Silverlight perspective, building the Web Service and using LINQ are related skills but beyond the scope of these tutorials. That said, we’ll examine how they intersect with Silverlight.

    The tutorial is based on material contributed by the Swiss MSDN Team who've produced a 15:00 video segment on it that you can watch at Silverlight 2 Beta1 + WCF + LINQ to SQL = a powerfull combination.

    Jesse offers a simpler LINQ to SQL to WPF demo (not Silverlight) in his LINQ To SQL blog post of March 26, 2008.

    It should be easy to substitute Entity Framework and LINQ to Entities for LINQ to SQL.

    Added: April 4, 2007

    Greg Beech Maps LINQ C# Query Expressions into the Underlying LINQ to Objects Method Calls

    Greg is a UK developer who's a Development Lead at blinkBox Entertainment currently focusing on the middle tier who's started a "Translating C# 3.0 query syntax for Linq-to-Objects" series. Greg observes:

    I haven't found any that go into the gritty details of how the query syntax is translated into the underlying method calls. It's a gap this series aims to fill.

    After an explanation of how the compiler handles the translation from query expressions to method calls, he maps the two in a small diagram near the end of each post:

    Following are the first three members of the series:

  • Translating C# 3.0 query syntax for Linq-to-Objects, Part 3: Where (4/3/2008)
  • Translating C# 3.0 query syntax for Linq-to-Objects, Part 2: SelectMany (3/29/2008)
  • Translating C# 3.0 query syntax for Linq-to-Objects, Part 1: Select (3/25/2008)

    I'll update this post as Greg posts additional translations.

    Austrailia's Zu Shoe Web Site Uses LINQ to SQL as its Data Access Layer

    Stefan Sedich, an ASP.NET developer for the Vivid Group in Perth, reports in his Our First ASP.NET 3.5 Site Goes Live!! post of April 3, 2008 that Zu Shoe's new site uses the latest technologies:

    • Visual Studio 2008
    • ASP.NET 3.5
    • LINQ to SQL
    • ASP.NET AJAX

    Stefan says:

    All in all this project was great to work on, being able to use .NET 3.5 and Visual Studio 2008 saved us a lot of time, and using LINQ to SQL cut down creating the DAL quite a bit. Of course with all new techs we have had challenges along the way, but still developed it a lot quicker using VS 2008 and .NET 3.5.

    This is the first large commercial site that I've heard uses LINQ to SQL as its data source. Vivid Group has two more ASP.NET 3.5 sites in the works.

    The site has flair; check it out!

    Jeff Currier Demonstrates How to Use SQL Server Data Services' SOAP Client

    Jeff's Interacting with SQL Server Data Services using SOAP post of April 2, 2008 describes SSDS's SOAP client and the generated C# code for the Scope object, which has the following four settings:

    Service Scope - This the scope when a scope object instance is passed to the service without any of the properties set.  This would typically be the case when the intent is to create a new authority object in the service.

    Authority Scope - When just the authority id is specified on the scope object.  This is generally the case when the caller is attempting to create a container, retrieve the set (or a restricted set) of containers from a given authority or finally when attempting to simply retrieve a particular authority instance.

    Container Scope - As you might imagine this scope is established when both the authority and container id properties are set on the scope object.  This scope is typically used when querying within a container for a set of entities (or all entities), creating new entities, or deleting a specific container.

    Entity Scope - Used to narrow the focus of the operation to be performed down to the entity level.  This is typically used when the caller is attempting to update, retrieve or delete a specific entity within the service.

    He then goes on to provide examples of creating a new Authority, Container and Entity, populating the Entity and finally reading its content.

    Following are Jeff's previous posts that cover Java and .NET REST clients:

    SQL Server Data Services Meet Java (Jakarta REST client, 3/19/2008)

    Some SQL Server Data Services Coding Examples (REST client, 3/17/2008)

    The SSDS Team Wants Your Input on SOAP Versus REST Wire Formats

    In the SSDS Team's Jeff has posted some SOAP samples post of April 3, 2008, kellyalt asks:

    We are interested in finding out how many out there will build against REST and how many will build using SOAP.  What are the considerations when you think about using one or the other?  How can we make these interfaces better over time?  These are some of the questions we have in our mind.  Would love to hear from you.

    My reply was 10:1 REST:SOAP because of simplicity and low overhead for public catalog data that doesn't require the WS-* security features afforded by the WSHttpBinding default.

    I'd need to have the REST and SOAP client bits and admission to the beta services to answer the "How can we make these interfaces better over time?" question.

    Overall, I'd say both questions are a bit premature.

    Julie Lerman Explains How to Leverage ObjectQuery Options on a LINQ to Entitities Query

    Julie observes:

    At design time, [a LINQ to Entitities] query is an IQueryable, not an ObjectQuery and doesn't have MergeOptions.

    So you can cast the LINQ to Entities query to an ObjectQuery, set the MergeOption and, as Jeffrey Palermo would say, party on the LINQ to Entities query.

    The whole story is in Julie's ObjectQuery, LINQ to Entities and IQueryable post of April 2, 2008.

    Taking Advantage of Stored Procedures in the Entity Framework

    The Entity Framework (EF) defaults to generating dynamic parameterized Entity SQL (eSQL) statements to populate (hydrate) entities from tables in the underlying relational data store and parameterized data manipulation language (DML) statements to create, update and delete entities and their associated tables.

    Many organizations and individual DBAs prefer or insist on the use of stored procedures rather than dynamic SQL for SELECT, INSERT, UPDATE or DELETE operations. Stored procedures prevent the need to grant users direct access to tables, which could compromise database security. In many cases, the capability to efficiently execute stored procedures instead of dynamic SQL is the principal determining factor in choosing an object/relational mapping (O/RM) tool.

    EF has built-in support for stored procedures but there's no central source of complete, up-to-date documentation and how-to information for using stored procedures with the current Beta 3 version and its Entity Data Model (EDM) Designer CTP 2. The EF Extensions, which add flexibility in the use of custom stored procedures and speed their execution, hasn't been widely used or thoroughly documented. (There were only 181 EF Extension downloads from the MSDN Code Gallery as of 3/31/2008, and Colin Meek only recently published his ADO.Entity Framework: Stored Procedure Customization article on 3/26/2008)

    The following three articles contain detailed instructions with screen captures and code examples for creating entities, changing from dynamic SQL to stored procedures, testing EDMs with stored procedures, as well as minimizing the number of stored procedure calls and improving performance with the EF Extensions:

    Migrating to SQL Server Stored Procedures with the EDM Designer December CTP 2 (March 27, 2008)

    Testing Stored Procedure Replacements for Entity SQL Statements (March 29, 2008)

    Minimize Stored Procedure Calls and Improve Performance with EF Extensions (March 30, 2008)

    Repeated from LINQ and Entity Framework Posts for 3/31/2008+.

  • Wednesday, March 26, 2008

    LINQ and Entity Framework Posts for 3/24/2008+

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

    Danny Simmons: Serializable Entity Framework Object Graphs Coming in Next CTP

    Hidden in an innocuous "WCF & Entity Framework not working as expected" thread started on October 31, 2007 in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum is this bombshell dated March 28, 2008:

    [W]e realize that it would be nice to have graphs of entities just serialize by default without these kinds of gymnastics, but there are some hard problems with doing this using WCF in an interoperable way given that EF relationships are always bi-directional which means that EF always has graphs not trees and the cycles in graphs cause problems with the default WCF (DataContract) serializers.  Happily we've been working with the WCF team, and they came up with a great way to deal with this, so the next CTP of the EF will serialize entity graphs by default. [Emphasis added.]

    If true, this new capability will obsolete Danny's EntityBag (Perseus) project. It wouldn't appear to eliminate the need for Ruurd Boeke's serialization to a lightweight client project, at least for Silverlight clients, but it might affect the market for IdeaBlade's DevForceEF product.

    The inability of the DataContractSerializer to handle cyclic references appeared to be a major stumbling block to enabling an "out-of-the box multi-tier story" for LINQ to SQL. Hopefully, Matt Warren and his C# team will take another look at enabling n-tier deployment for LINQ to SQL projects.

    Thanks to Julie Lerman for the head's up: Hallelujah - Entity Graphs will be XML serializable.

    Added: 3/28/2008

    Performance Problems Fixed for VB Queries with Filters Over Nullable Columns

    Tim Ng reports in the VB Team's LINQ to SQL (and LINQ to Entities) performance improvements post of March 28, 2008 that LINQ to SQL and LINQ to Entities queries are "now smart enough to pass three-value logic from VB to SQL." This means you'll get

    SELECT [t0].[CustomerID] 
    FROM [dbo].[Orders] AS [t0] 
    WHERE [t0].[EmployeeID] = @p0 
    -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [123]

    instead of

    SELECT [t0].[CustomerID] 
    FROM [dbo].[Orders] AS [t0] 
    WHERE (COALESCE( 
        (CASE 
            WHEN [t0].[EmployeeID] = @p0 THEN 1 
            WHEN NOT ([t0].[EmployeeID] = @p0) THEN 0 
            ELSE NULL 
         END),@p1)) = 1 
    -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [123] 
    -- @p1: Input Int (Size = 0; Prec = 0; Scale = 0) [0]

    when you filter on the nullable Orders.EmployeeID field.

    Added: 3/28/2008

    Ajax World: "Microsoft SSDS - Dumb Name, Brilliant Idea!"

    Tim Negris' AjaxWorld Magazine article of March 17, 2008 has this deck: "A Google News search for Microsoft SSDS, the SQL Server Data Services it announced last week, yields just six articles." If Tim had broadened his search beyond New articles, he would have found hundreds of SSDS blog posts by March 17.

    Tim explains the article's title:

    To understand the potential impact of Microsoft's cloud strategy and SSDS service initiative on Oracle, IBM/DB2, Sun/MySQL, Ingres, Postgres and other relational or post-relational database management systems, it's important to note that SSDS has nothing to do with SQL. SQL Server Data Services is a dumb name because, while the service is apparently based at the storage level on Microsoft's SQL Server technology, it doesn't use SQL (Structured Query Language) or a variant of it to query the information in the database. It uses a new Microsoft language called LINQ.

    He goes on to say:

    LINQ enables full text search, page search, and presumably things like picture and audio search against items stored in the Microsoft SSDS database.

    and notes earlier:

    Keep in mind that "data" [stored by SSDS] can mean way more than inventory or contact records in columns and rows of text and numbers. Data can mean documents, e-mails and web pages, or music and video.

    Neither of the preceding two excerpts are correct, at least for SSDS v1.

    SSDS's only connection with AJAX that I can come up with is the promise of a JSON wire format for a future version.

    Thanks to the SQL Server Data Services team for the heads-up: Interesting take from Rick Negris over at AjaxWorld magazine.

    Added: 3/28/2008

    Bryan Dawson Compares Performance of Entity Framework' eSQL and LINQ to Entities with SqlClient and T-SQL

    Bryan follows up his two previous performance-related posts (Exploring Performance Part 1 of February 4, 2008 and Exploring Performance Part 2 of February 11, 2008) with ADO.NET Entity Framework Performance Comparison of March 27, 2008.

    Bryan analyzes execution time of conventional and paging queries with no tracking for object queries. His graph shows the Entity Framework is about 4 to 5 times slower than SqlClient for paging queries. However, I believe Bryan's calculations are wrong for Entity SQL and LINQ to Entities paging queries.

    My calculations, based on 100 tries with 64 ms. and 87 ms. for Entity Client and LINQ to Entities respectively appear in the Corrected column:

    Query Type Standard Query Paging Query Corrected
    SqlClient/T-SQL 4.0 ms 0.43 ms 0.43 ms
    Entity SQL 6.0 ms 1.5 ms 0.64 ms
    LINQ to Entities 7.5 ms 2.0 ms 0.87 ms

    The ratios between execution times for Standard Query and Paging Query don't correspond, but Standard Query and Corrected ratios track closely.

    Moral of this story: It pays to apply reasonableness tests before publishing performance results.

    Added: 3/28/2008

    Noam Ben-Ami Explains Simple Stored Procedure Mapping and Raises a Red Flag

    Noam's Stored Procedure Mapping of March 26, 2008 (which appeared in the ADO.NET Team Blog on March 28) provides a script to create simple Product and Order tables as well as INSERT, UPDATE, and DELETE stored procedures for the Product table. Noam adds this caveat in his instructions:

    At this point it is appropriate to note the first stumbling block: At this time, the Entity Framework requires you to map all three stored procedures. You cannot map only the delete stored procedure. In addition, the entity type must still be mapped to a table, view, or query view.

    The requirement to map all three updated stored procedures is unadvertised but mentioned in a newsgroup post. Noam says the following about this requirement:

    We hope to provide a solution for this issue in future versions of the Entity Framework, but for now, this is what needs to be done for associations whose target multiplicity, with respect to the type being mapped, is 1 or 0..1. In other words, the “reference” end of the association needs to be mapped to the keys of the target type.

    I've never heard of a restriction that prevents executing update stored procedures against an Entity instance mapped to a FunctionImport. I've retested my initial test code that executes the INSERT, UPDATE and DELETE stored procedures and don't encounter a problem.

    Added: 3/28/2008

    Migrating to SQL Server Stored Procedures with the EDM Designer December CTP 2

    Migrating the data source for Entity Framework (EF) EntitySets and AssociationSets from dynamic Entity SQL (eSQL) to dynamic SQL (T-SQL) commands to stored procedures (sprocs) with the Entity Data Model (EDM) Designer December CTP 2 isn't a walk in the park.

    There's little in the way of official or unofficial documentation that specifies EF's requirments for supporting sprocs as data sources and data modification agents. What little information is available is buried in ADO.NET Team members' replies to a few users questions in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum.

    Earlier ADO.NET Team posts don't cover the EDM Designer's role in the process. For example, How to Map Stored Procedures using the ADO.NET Entity Framework of September 14, 2007 covered only the schema syntax and didn't discuss associations or updates. The earlier Using Stored Procedures for Change Processing in the ADO.NET Entity Framework of March 8, 2007 is more than a year old.

    My Migrating to SQL Server Stored Procedures with the EDM Designer December CTP 2 post provides illustrated step-by-step instructions for moving the Products, Supplier, and Categories EntitySets from default eSQL queries and commands to a set of T-SQL stored procedures for EntitySet hydration and Entity instance updates, and covers mapping Associations as well as stored procedures for populating AssociationSets.

    A future post will show the code required to test the migration.

    Added: 3/27/2008

    Ruurd Boeke Continues his Lightweight Client for the Entity Framework Project

    The "Ruurd Boeke Plans a Entity Framework Variant with a Lightweight Client" topic of  LINQ and Entity Framework Posts for 3/17/2008+ describes Ruurd's objectives for a disconnected Entity Framework component with a lightweight client that can be used in a Silverlight project:

    So, the end result should be an easy way to serialize and deserialize objects on the client and server, and a way to build up the object correctly on the server so it can be attached to the context again.

    Ruurd's approach differs considerably from Danny Simmons' Perseus: Entity Framework EntityBag project on the MSDN Code Gallery, which I described in the "Retrieve and Update Entities Across Tiers with WCF and the EntityBag" sidebar for my "Model Domain Objects with the Entity Framework" for the March 2008 issue of Visual Studio Magazine.

    His Relation support for n-tier EF post of March 27 provides code and message examples for serializing Entity updates with WCF's DataContractSerializer. You can compare his messages on the wire with those for Perseus that I described in my Logging EntityBag's SOAP Request and Response Messages post of January 29, 2008.

    Ruurd concludes:

    The API I have created is monstrous. Also, I think there are quite a few situations where this will break horribly.

    Once I get just a little happier about it, I will do a screencast building a server using Entity Framework and a Silverlight client that is editing.

    Added: 3/27/2008

    Colin Meek: EF Extensions for Custom Stored Procedures with the Entity Framework

    Colin, an EF developer, starts his new blog with ADO.Entity Framework: Stored Procedure Customization post of March 26, 2008 which provides documentation for the Entity Framework Extensions described in this week's "Entity Framework Extensions Library Available for Download from MSDN Code Gallery" topic.

    His post describes how to use the extensions to simplify running arbitrary stored procedures and T-SQL commands as store commands against an ObjectContext, materialize them as objects, track changes, and deal with multiple result sets. The post describes the following coding patterns:

    • Creating and executing store commands
    • Materializing typed results
    • Tracking results
    • Multiple result sets

    Alex James waxes enthusiastic about EF Extensions in his Colin Meek talks about his EF Extensions post of the same date:

    Here is a little snippet that illustrates what is possible [with a typed materializer]:

    var results = context
    .CreateStoreCommand("GetCategories", CommandType.StoredProcedure)
    .Materialize<Category>()
    .Bind(categorySet);

    What this does is execute the GetCategories stored proc, turning results into Category objects and binds them to the categorySet entityset so that changes can be tracked/managed by the Entity Framework.

    Update 3/27/2008: Diego Vega adds more praise for the extensions in his Entity Framework Extensions (EFExtensions) Project available in CodeGallery post of March 27, 2008.

    If you're populating entities with stored procedures, be sure to read Colin's post, download the EFExtensions and EFExtension Samples and give the sample project a test drive.

    Added: 3/26/2008

    Freek Leemhuis Scorns LINQ to SQL and Others Pile On

    LINQ to SQL problems, which Freek posted on March 26, 2008, takes Anko Duizer's LINQ to SQL - TOP 5 of problems post of March 14, 2008, and contributes explanations of why Freek considers the following problems serious:

    1. LINQ to SQL is designed for a two tier scenario. LINQ to SQL does not fit natural[ly into] a multi layer architecture.
    2. It is not possible to tune the SQL Server queries generated by LINQ to SQL.
    3. LINQ to SQL generates dynamic SQL. The technology strongly motivates use [olf] dynamic SQL instead of stored procedures.
    4. LINQ to SQL encourages ... "SELECT *" quer[ies.]
    5. The cache mismatch problem. LINQ to SQL materialize[s] your objects "once" in the cache, this can give unexpected query results.

    Paul Gielens adds #6 in his LINQ to SQL - TOP 5 + 1 of problems post of March 25:

    #6 LINQ to SQL is intended for direct 1-1 mapping of a Microsoft SQL server database to .NET classes. LINQ to SQL is not a natural fit in typical enterprise scenarios.

    LLBLGen's Frans Bouma pronounces judgment in his detailed comment to Paul's post:

    Item 3, 4 and 5 for example are noise or wrong. ... Your #6 point is also noise, sorry :). ... Point 2 is valid.

    and recites his usual litany of complaints about LINQ to SQL. Be sure to read the rest of the comments.

    Note: Freek has written about LINQ to SQL previously. Click here for his posts tagged LINQ.

    More Reasoned Views of LINQ to SQL Issues

    Freek also includes a reference to Bob Beauchemin's MHO: LINQ to SQL and Entity Framework: Panacea or evil incarnate? Part 1 post of February 13, 2008. However, Bob generally debunked #2, #3, and #4 in this post. See the "Bob Beauchemin Starts a Series About LINQ to SQL and Entity Framework" of LINQ and Entity Framework Posts for 2/25/2008+.

    Similarly, Bob's later posts offer rational evaluations of other topics. See the "Bob Beauchemin Addresses LINQ to SQL/Entity Framework Worry Points 4, 5 and 6" topic of LINQ and Entity Framework Posts for 3/6/2008+.

    As to #1, LINQ to SQL fits without difficulty into a multi-layer architecture. The issue is its problems in with n-tier architecture. Keith Farmer made a strong point in his LINQ and 3-Tier Dogma post of November 6, 2007:

    I know someone somewhere is going to accuse me of heresy for what I'm about to state, but it's something I've wanted to get off my chest for a couple years, since I first encountered LINQ to SQL, and started to realize what it meant...

    The 3-Tier Model is just a pattern.

    And, like all patterns,

    It is meant to serve our needs, not the other way around.

    Don't get hung up on academic concerns such as how many tiers you have in your system.  You'll just waste the time you could spend doing things you actually need to do.  Such as watching Avatar or playing Warcraft.

    As evidenced by the amount of work being devoted to change tracking in disconnected (i.e., n-tier) scenarios, the n-tier issue might not remain for long.

    Added: 3/26/2008

    Matthew Hunter Updates LINQ to SQL Entity Base 1.0 to Beta 1.2

    LINQ to SQL Entity Base 1.0 now supports change tracking for deletions and can perform cascade deletions. His New Version of LINQ to SQL Entity Base Class (Beta 1.2) post of March 26, 2008 adds:

    I guess from my point of view it's feature complete for ASP.NET use, assuming you store the entities in the session.

    Still have to work on serialization for WCF and other uses.

    Here's the CodePlex link: LINQ to SQL Entity Base Class Version 1.0 Beta 2.0

    The "Matt Hunter: Another Disconnected LINQ to SQL Project" topic provides more details on LINQ to SQL Entity Base.

    Added: 3/26/2008

    Update 3/28/2008: Implementing Deletion Change Tracking adds a SetAsChangeTrackingRoot() method to establish the baseline original values of an object and implements cascading deletions on the client.

    Avi Wortzel Demonstrates a Complete Mock Object for LINQ to SQL

    Israeli developer Avi Wortzel's Testing LINQ to SQL with Mock Object – a complete solution post of March 25, 2008 explains:

    I decided to implement my own solution which includes two parts:

    1. The ability to create database states [to] test the queries against ... (without the need of active SQL Server [o]n the air).

    2. The ability to mock DML operations without actually execut[ing] them (and to create a database-less tests [= Tests that don’t have an active instance of SQL server to run]).

    For the first part I used the Repository pattern (as the other guys suggested) and I referred the class which represent[s] the table as an in-memory one. It’ll give us the ability to query it with LINQ to Object. To achieve the second part I mocked the SubmitChanges() method from the DataContect class.

    It appears to me to be a workable approach for removing SQL Server from the test loop. Avi's downloadable example uses Oren Eini's Rhino Mocks framework.

    Added: 3/26/2008

    Doug Rothaus: VB's XML Axis Properties and LINQ to XML for Accessing Descendent and Ancestor Elements

    His VB XML Cookbook, Recipe 2: Descendants and Ancestors post of March 19, 2005, which didn't appear in the Visual Basic Team blog until March 25, "shows how you can access descendant and ancestor elements in an XML document using Visual Basic, XML Axis properties, and LINQ to XML objects."

    Julie Lerman: Build Before Changing Entity Framework XML Files to Resources

    Her Tip for working with embedded Ent. Framework models with Beta3 of March 25, 2008 explains Beta 3's problems with moving *.csdl, *.msl and *.ssdl files from the execution folder to project resources.

    K. Scott Allen Explains Outer Joins with the LINQ GroupJoin Operator

    Scott digs into creating the equivalent of SQL's LEFT OUTER JOIN with the LINQ GroupJoin, SelectMany, and DefaultIfAny operators in his Inner, Outer, Let's All Join Together With LINQ post of March 24, 2008.

    Entity Framework Extensions Library Available for Download from MSDN Code Gallery

    Colin Meek posted ADO.NET Entity Framework Extensions to the ADO.NET Entity Framework & LINQ to Relational Data section of the MSDN Code on March 24, 2008.

    The undocumented extensions claim to simplify "various tasks in the Entity Framework including store command execution, entity state management and stored procedure mapping."

    Update 3/26/2008: Documentation is available. See the "Colin Meek: EF Extensions for Custom Stored Procedures with the Entity Framework" topic.

    Anything that simplifies stored procedure mapping is appreciated.

    Thanks to Julie Lerman for the heads-up.

    Live Demo of CSDL, MSL, and SSDL File Content for Entity Framework Inheritance and Other Scenarios

    Asad Khan's downloadable Entity Framework Mapping Helper project from the MSDN Code Gallery is an interactive Windows form that displays the XML content of the CSDL, MSL, and SSDL layer for a variety of different scenarios. These include combinations of inheritance types (table per hiearchy, table per type, table per complex type, or mixtures of all three) with entity splitting, abstract types, complex types, and associations.

    The project has self-contained *.csdl, *.msl and *.ssdl files for what appears to be a country club, so all you need to do is mark one of the inheritance check boxes and click the Display Mapping button to start.

    Julie Lerman's EF Mapping Helper on Code Gallery post of March 24, 2008 provides a more detailed description and several screen captures of the Mapping Helper in action.

    Andy Conrad: New Features in Store for ADO.NET Data Services V2

    According to Andy's Astoria team is hiring! post of March 24, 2008:

    We have positions open for Developers and Program Managers.  Currently, we are finishing up V1 and planning for V2, so it’s a great time to join the team.  For V2, we are thinking about expanding the project into new areas (e.g. offline support, sync, dynamic language support) so there will be plenty of new and exciting work.

    Adding resources to the Astoria team also bodes well for its future as the on-premises version of SQL Server Data Services.

    Eugenio Pace Continues His LitwareHR Series with Data Caching Episode

    Eugenio ported the LitwareHR hosted multi-tenant demo app from SQL Server 2005 to SSDS, as described in his SQL Server Data Services - SSDS - New version of LitwareHR post during MIX 08.

    His LitwareHR on SSDS - Part III - Data access enhancements 1: caching post of March 24, 2008 describes client-side caching at the Web services layer with a CacheManager (based on the Enterprise Library's caching block) and Repository to get and store cached and uncached items.

    Here are links to earlier episodes:

    The LitwareHR on SSDS - Part II - The data access layer post explains that the new client data model for SSDS implements an SSDS SOAP Client, ProxyFactory and Repository<T> stack, which replaces the previous SQL Server-based version's Data Access Application Block (DAAB) and MultiTenantDataAccess layer.

    His LitwareHR on SSDS - Part I - Multi-tenancy & Flexibility post of March 14, 2008 explains SSDS's Authority-Container-Entity (ACE) storage architecture and how LitwareHR uses it to store individual Position and Resume entity sets for each tenant.

    Justin Etheredge Continues Improvement to LINQ to Mock (Moq) Implementation for ASP.NET MVC

    The Grouping expectation verification in Moq post of March 24, 2008 documents Justin's continued effort to use LINQ to Mock (a.k.a. Moq) to provide a complete mocking framework for the ASP.NET Model-View-Controller add-in.

    Click here for more about LINQ to Moq and ASP.NET MVC, plus Justin's previous episodes.

    LINQ to Firebird (Entity Framework Provider for Firebird) Is Progressing

    Jiří Činčura's Entity Framework and Firebird (Part 2) post of March 24, 2008 describes the progress to date on creating an Entity Framework-enabled data provider for the Firebird open-source database (formerly Borland's InterBase RDBMS). The developer, jirka, says:

    We're moving, slowly, step-by-step. And new functionality is coming in view. ... Yes, it's a "LINQ to Firebird", in fact LINQ to Entites connected to Firebird.

    Here's the initial post of March 20, 2008: Entity Framework and Firebird.

    Matt Hunter: Another Disconnected LINQ to SQL Project

    Another from the How Did I Miss That? Department:

    Matt released v1.0 Beta 1.1 of his LINQ to SQL Entity Base - Disconnected LINQ CodePlex project on March 20, 2008. Matt describes his project:

    LINQ to SQL Entity Base is a simple base class that is primarily designed to support LINQ to SQL in a disconnected way, which is one of the shortcomings of the LINQ to SQL technology at the present time. This is highly useful in an n-Tier or ASP.NET environment where disconnected functionality is relavent.

    LINQ to SQL Entity Base includes change tracking support in a "disconnected from data context" mode.

    LINQ to SQL Entity Base also supports automated re-syncing of entities to a data context. This includes all entities under a entity tree which is basically all parent --> child type relationships.

    There's more background information on LINQ to SQL Entity Base in Matt's .Net Blog for Software Developers blog.

    Benjamin Eidelmann: A Disconnected LINQ to SQL Project

    From the How Did I Miss That? Department:

    Jose Marcenaro, Benjamin Eidelman and Ricardo de Guzmán of Argentine developer Tercer Planeta have posted the Unplugged LINQ to SQL Generator project (ULINQ) to CodePlex. Benjamin says:

    Fitting the LINQ to SQL technology in your own N-tier application framework may require writing custom code for the entities.

    This project implements a custom tool for generating code from a DBML model, which you may use instead of the default MSLinqToSQLGenerator in C# or VB projects.

    Click here to read background details on the ULinqToSQLGenerator from the Tercer Planeta blog.

    Saturday, March 22, 2008

    LINQ and Entity Framework Posts for 3/17/2008+

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

    Updated 3/22/2008 for confirmation that SSDS "will support the full EDM/EF/ADO.Net V3 model in due time," per Soumitra Sengupta. (That's the primary justification for including SSDS-related posts in this blog.)

    Updated 3/23/2008 by adding Ruurd Boeke's Sneak preview: serializing objects with original values post of 5/17/2008 (missed), which adds information about the IEditableBusinessObject class, to the "Ruurd Boeke Plans a Entity Framework Variant with a Lightweight Client" topic.

    David DeWinter Adds Dynamic Menu Commands to his LINQ to SQL Database Update Sync Project

    Dave started a project in January 2008 to write a Visual Studio 2008 plug-in with capabilities to:

    1. Transform property names to be Pascal case
    2. Remove prefixes from the names of database objects
    3. Automate mapping the types of columns to various (developer-defined) enumerations

    for LINQ to SQL projects.

    The following posts supplement his source code in CodePlex's Entity Framework Contrib (EFContrib) section:

    Added: 3/23/2008

    Dave Robinson Posts Source Code for an Excel Add-in That Saves and Retrieves Worksheets to/from SSDS

    Dave, who's the "new SSD blogger" I mentioned in the "New SQL Server Data Services Blogger and a Third-Party View of SSDS (et al.)" topic below, has written an Excel 2007 add-in that stored worksheet data to and retrieves it from a SQL Server Data Services container. His Using Excel with SSDS post of March 21, 2008 includes the SSDS-specific source code.

    He promises a later post that demonstrates syncing data with the Microsoft Synchronization Framework.

    Added: March 22, 2008

    Beth Massi Plans Yet Another VB and XML Webcast on April 4, 2008

    Beth's Live From RedBethmond: VB9 - Working with XML in Visual Basic post of March 21, 2008 gives the following description:

    4/4/2008 9:00 AM Pacific Time (US & Canada) | Duration:60 Minutes
    XML permeates every modern application today from XHTML, XAML, RSS, SOAP, Office Open XML just to name a few. Even your Visual Studio project files and configuration settings are XML files. The latest version of Visual Basic in Visual Studio 2008 supports a new language syntax aimed at making you much more productive when working with XML. In this Webcast we'll walk through language features like XML literals, embedded expressions and axis properties in order to create, query and transform XML with this powerful but easy to use syntax. Say goodbye to XSLT and hello to Visual Basic 9.

    Added: March 22, 2008

    The SQL Server Data Services Team Wants to Answer Your Questions about SSDS

    Jeff Currier posted What questions do you have about SQL Server Data Services? on March 21, 2008. His post contains this question:

    I've written several posts now around coding (in C# and in Java) about using SSDS.  So, I'm a bit curious if anyone out there has specific questions that either I (or others on team) might be able to answer.  This could be code related, design related, etc.  So, what questions do you have?

    My questions were (paraphrased):

    1. How and when do you plan to support associations/relationships plus lazy/eager loading?
    2. How and when will applicants be notified of acceptance or rejection as beta invitees?
    3. What's the timeframe for adding the promised Atom/AtomPub format?

    I probably should have omitted lazy loading from question #1.

    Added: March 21, 2008

    Update March 22, 2008 from Soumitra Sengupta in his Answering a few questions from Jeff's blog response to my questions:

    1. What are your plans and timing for supporting associations/relationships plus lazy- and eager-loading?

    Answer to the first question is that we will support the full EDM/EF/ADO.Net V3 model in due time.  It is a bit of work.  We do not have exact timing for it.  Once we do that we will have to address lazy and eager loading, right?

    2. When will folks who signed up for the beta know if they've been accepted?

    First batch should go out next week.  We will keep provisioning on a weekly basis from there on out.  By the way once the first batch gets provisioned, everyone else should be able to get to the technical documentation.

    3. What's the schedule for an Atom/AtomPub implementation?

    We are on this one.  Do not have the exact schedule to share at this time.

    Good news on all but the timing of #3, but especially #1.

    Soumitra's post also responds to questions from several other readers.

    Ruurd Boeke Plans a Entity Framework Variant with a Lightweight Client

    Ruurd's Progress on light objects on the client, full blown EF entities on the backend post of March 21, 2008 describes his work to date on an n-tier variation on the Entity Framework (EF) that eliminates the need to deploy the entity framework to the client tier. His objectives are:

    What I want is one visual studio project: 'Domain' that holds business objects for me that I can use on both the client and the server. What I do not want, is to have to think about Entity Framework contexts on the client. Since I do not persist my objects on the client, I see no reason to actually create a context on the client, just to be able to do change tracking. Nor do I want to see any EF specific plumbing in the messages between that client and server: I lose interoperability if I do that. Also, if my client is Silverlight (for instance) I might not want to bring the EF assemblies over (if that's even possible?).

    So, the end result should be an easy way to serialize and deserialize objects on the client and server, and a way to build up the object correctly on the server so it can be attached to the context again.

    Updated 3/23/2008: The client objects will be implementations of Ruurd's IEditableBusinessObject interface, which he describes in his earlier Adding Edit support to businessobjects post of March 16, 2008 and Sneak preview: serializing objects with original values of March 17. The "Ruurd Boeke Adds Complex Types to His IPOCO Entity Framework Implementation" topic of LINQ and Entity Framework Posts for 3/10/2008+ contains links to his earlier Entity Framework posts.

    The Sneak Preview poses describes his classes for serializing objects with original values:

    EditableBusinessObject implements IEditableObject for you and also allows you to copy the currentvalues to a loadedvalues state.

    CreateSerializeSurrogate generates a surrogate class that knows how to deal with loadedvalues and with circular references.

    It appears to me that Ruurd's objectives are similar to those of IdeaBlade for their DevForce EF project, which is presently in beta. Ruurd's client is likely to be much lighter, which would make it more appropriate for deployment in a Silverlight project. However, IdeaBlade is hard at work on a Silverlight 2 client that uses a version of their existing DevForce framework (see below).

    Added: March 21, 2008

    IdeaBlade Posts 45-minute Screencast of their DevForce EF n-Tier Entity Framework Implemetation

    You can play the Camtasia screencast from a link on IdeaBlade's main DevForce EF page. The product looks quite interesting to me. Both IdeaBlade and Ruurd Boeke avoid serializing and transporting the ObjectContext across process boundaries.

    Thanks to Julie Lerman for the heads up on the video's availability.

    My original post about DevForce EF was the "IdeaBlade Offers Downloadable Beta of DevForce Entity Framework" topic of LINQ and Entity Framework Posts for 3/10/2008+.

    Added: March 21, 2008

    Mike Taulty Writes an Essay On Disposing LINQ to SQL Data Contexts

    Mike normally encloses his LINQ to SQL data access code in a Using block to ensure that it's disposed expeditiously, closes the SqlClient connection and returns it to the connection pool as quickly as possible. I do the same if I don't want to cache collections as a generic List in a WinForm or Silverlight project.

    Unlike me, Mike decided to determine whether the Using block was necessary to close the connection immediately, rather than waiting for finalization.

    Read Mike's LINQ to SQL and SqlConnection post of March 20, 2008 to learn what he discovered.

    As a bonus, you can download the demo code from Mike's LINQ Talk at UK Visual Studio 2008 Launch. Mike's LINQ to SQL demo starts with:

    using (DataContext ctx = new DataContext(
          "server=.;database=northwind;integrated security=sspi"))

    Added: 3/20/2008

    New SQL Server Data Services Blogger and a Third-Party View of SSDS (et al.)

    "Life in the clouds..." is the name of David Robinson's new SSDS blog. Dave is a program manager for SSDS and plans to evangelize SSDS on The Code Trip at the University of Southern California on March 27, 2008 and the Microsoft Health & Life Sciences Developer and Solutions Conference 2008 on April 22-24. The following is from his first post:

    What’s this blog all about you ask? Well it is going to be mostly focused on developing solutions on top of SSDS, but there will also be tidbits of other cool technology and an occasional rant or two.

    Dave's most March 19 post points to Max Zilberman's SQL Server Data Services (SSDS) - a powerful proposition... post of March 18, 2008. Max, who works in Philadelphia as an Enterprise Software Architect for a Fortune 100 firm, says this about SSDS:

    Many blogs have written about the nice bits announced at the MIX such as IE8, Silverlight Mobile, Silverlight 2.0 Beta, among others.   The session that was not given high level of attention, the SQL Data Services sent a really powerful message.

    And goes on to explain why hosted data services make business sense.

    Max also has nice things to say about ASP.NET Dynamic Data and ADO Entities - The new beginning.....

    Added: 3/20/2008

    An ASP.NET Model-View-Controller Tech Brief, Mock Frameworks and LINQ to Mock (Moq)

    My ASP.NET MVC: Is the new MVC pattern right for you? TechBrief for Redmond Developer News' March 2008 issue points out that Scott Guthrie makes the following claim for ASP.NET's MVC feature:

    .NET MVC ships with System.Web.IHttpRequest and IHttpResponse interfaces; this simplifies mocking the interfaces to deliver improved unit-test performance.

    Scott Hanselman followed up his ASP.NET MVC Preview 2 session at MIX 08 with the ASP.NET MVC Session at Mix08, TDD and MvcMockHelpers post of March 7, 2008. This item includes MvcMockHelper source code for RhinoMocks, which Scott demonstrated in his session, Moq, a.k.a. LINQ to Mock, and TypeMock, a commercial framework. The helper code for all three frameworks is of similar complexity.

    Scott had previously reviewed MOQ in his Moq: Linq, Lambdas and Predicates applied to Mock Objects of December 19, 2007, which starts with:

    Kzu and friends have a new pet project called Moq, which may be the coolest derivative open source project name ever.

    And ends with:

    Slick. Moq is definitely a project to watch.

    In between, Scott compares NMock, RhinoMock, TypeMock and Moq.

    The "Daniel Cazzulino and Juan Wajnerman Create LINQ to Mock (Objects)" topic of LINQ and Entity Framework Posts for 12/17/2007+ has more details on the release of LINQ to Mock. (From the "Scott Hanselman Endorses LINQ to Mock (Moq)" topic of LINQ and Entity Framework Posts for 1/7/2008+.)

    Kaz posted his Why do we need yet another NET mocking framework? essay on March 17, 2008. Justin Etheredge's Asp.net MVC Testing Imbalance of March 19, includes sample Moq code for a simple MVC Update action. Here's his complaint about the amount of mocking code required for a relatively simple unit test:

    And that doesn't even include any of my helper objects or methods. Anyone see a problem with this? I am going to have to put some serious effort into streamlining this. I know that there is quite a bit I can abstract out across different controllers and actions so we will see how this goes.

    I have the same problem with the mocking frameworks I've investigated. Regardless of the complexity issue, Moq is gaining well-deserved attention.

    Updated 3/23/2008: Justin's Simplified Asp.net MVC Controller Testing with Moq of March 22, 2008 post simplifies the UserControllerUpdateTest() method by refactoring with helpers, such as CreateMockUserRepository() and CreateMockUserController() methods and a MockHttpContextContainer() class.

    Added: 3/20/2008

    Updated 3/21/2008: David Longnecker offers two posts on unit testing ASP.NET MVC projects: Exploring the ASP.NET MVC Preview 2 - First Glance and Exploring the ASP.NET MVC Preview 2 - Tests and Mocks, both of March 20 2008. The latter uses LINQ to Mock (Moq).

    Eugenio Pace Continues His LitWareHR for SQL Server Data Services Saga

    His LitwareHR on SSDS - Part II - The data access layer explains that the new client data model for SSDS implements an SSDS SOAP Client, ProxyFactory and Repository<T> stack, which replaces the previous SQL Server-based version's Data Access Application Block (DAAB) and MultiTenantDataAccess layer.

    His entity-specific classes derive from the ExtensibleEntry base class, which provides the Id property required by SSDS, as well as Code and Location properties, which are common to all LitwareHR entities. His example contains a simple unit test to verify Insert() invocations by invoking an InsertKindGetByIdDelete() TestMethod.

    The "Eugenio Pace Starts a Series on the LitwareHR Demo on SQL Server Data Services" topic of LINQ and Entity Framework Posts for 3/10/2008+ covers the first part of this series.

    Added: 3/19/2008

    Jimmy Bogard Finds XML-File Mapping Delivers Persistence Ignorance to LINQ to SQL Business Objects

    Jimmy purchased a copy of LINQ in Action and discovered that you have four choices for mapping SQL Server tables to LINQ to SQL entities and associations:

    1. Visual Studio 2008's graphical O/R Designer
    2. The SqlMetal.exe command-line tool
    3. Custom class files you write to define entities with mapping by attributes you add to the classes and their properties
    4. A custom XML mapping file you create and process with SqlMetal.exe

    He concludes that choice #4 provides persistence ignorance.

    But his Mapping options in LINQ to SQL post of March 18, 2008 concludes:

    For me, the final verdict is: Though LINQ to SQL gives me powerful strongly-typed querying abilities with LINQ, the only maintainable mapping option still pales in comparison to NHibernate.

    Added: 3/19/2008

    Jason Hunter Demos a Master/Detail Form with a SQL Server Data Services Back End

    In his SSDS Patterns Part 1: Master/Detail in a Heterogeneous World post of March 18, 2008, Jason creates the classic Windows read-only master/detail form that displays a drop-down list of Customers, a DataGridView for Orders from the customer, and another DataGrid view of details (Lines) for the selected Order. He shows the minimal source code to populate the list and bind to the BindingSource controls for the DataGridViews to the objects created from the SQL Server Data Services (SSDS) entities with XML serialization code.

    Jason, who's a dev lead in the SSDS group, promises his next post will demo "XML serialization to bridge the gap between SSDS and objects."

    See the related "Jeff Currier Shows Source Code for SQL Server Data Services HttpRequest and HttpResponse Methods>" topic below.

    Added: 3/18/2008

    Danny Simmons: An Essay on Deleting Entity Framework Entities

    Danny's Just delete it already! post of March 18, 2007 describes in detail why deleting a "fake" entity with associated entities in the data access layer requires more than just creating the entity and it's EntityKey, attaching it to the ObjectContext, and then invoking DeleteObject(). The incentive for faking an entity is saving a roundtrip to the data store to retrieve it.

    You must have access to the associated entities so you can delete their AssociationSets in the process. This means you must execute an ObjectQuery to retrieve them. In this case, you might as well retrieve the entity from the data store, because it will retrieve the entity of interest and its associated objects (as the "relationship span") with a single query.

    Deleting many:1 EntitySets for AssociationSets represented in the store by nullable foreign key values isn't a problem. In this case, the generated SQL statement just sets the foreign-key value to null. Deletions become more complicated when associations are required by specifying NOT NULL foreign key values in the database. Deleting 1:many EntityReferences isn't a problem whether they're required or not; cascading deletion simply removes the dependent entities associated with the deleted parent along with the relation.

    More about issues with deleting many:1 EntityRefs for required AssociationSets will follow.

    Added: 3/18/2008

    Greg Duncan Insists on Stored Procedures for Production LINQ to SQL Queries

    Greg is Development Manager/Primary Developer for KMPG's Electronic Data Discovery (EDD) product line. Greg describes EDD as

    Taking "electronic data" (files, emails in PST/NSF's,etc) gathering metadata, deduping, converting to PDF/Tiff/JPG and exporting for loading into litigation support systems.

    His LINQ to SQL NOLOCK'ing post of March 18, 2008 includes a quote from Scott Hanselman's Getting LINQ to SQL and LINQ to Entities to use NOLOCK post of March 17, 2007, which suggests replacing the NOLOCK hint for queries with TransactionScope and System.Transactions.IsolationLevel.ReadUncommitted. Either prevents long-running transactions from blocking reads but can lead to retrieving inconsistent data.

    Greg says "I use the NOLOCK hint in my SQL 2000 world a bit" and goes on to say:

    Now that said, I'm still not going to "endorse" LINQ to SQL for production usage yet at work, UNLESS our existing stored procedures (or new SP's) are used. And you know what? SP's work nicely with LINQ to SQL. I was able to drop some tables into the design surface, drag over some SP's, set some properties and I was LINQ'ing quite well. Select, inserts and updates working easily all the time through our SP's. There were quite a few "oh that's just cool" moments.

    Why SP's? Because they have saved my bacon a number of times over the years (I've been coding against SQL Server since 4.21a...). Practical real world experience has re-enforced my belief in SP's as my primary DB level API. Not a religious thing, just an experience thing...

    LINQ to SQL's graphic designer makes substituting stored procedures (sprocs) for parameterized dynamic T-SQL in CRUD operations easy, but doing the same in Entity Framework involves manually editing the SSDL and MSL files with Visual Studio 2007's (or another) XML Editor. The XML editor has schemas for *.edmx, *.csdl, and *.ssdl files to support IntelliSense, but not for *.msl files. Mapping and testing sprocs for associations/relationships is an agonizing process.

    The Stored Procedure Support (Entity Framework) online help topic for ADO.NET Entity Framework Beta 3 provides simple examples. See the ADO.NET Team's "Using Stored Procedures for Change Processing in the ADO.NET Entity Framework" post of March 8, 2007 and "How to Map Stored Procedures using the ADO.NET Entity Framework" post of September 14, 2007 by Mike Dodaro for examples with more detailed explanations.

    If you're working with Entity Framework and your DBA insists on stored procedures for updates, you might try getting an exemption by explaining the mapping issues involved.

    Added: 3/18/2008

    Jim Wooley Explains LINQ Joins on Composite Keys

    In Joining composite keys with LINQ of 3/17/2008, Jim observes that

    [T]he Join extension method does not support the ability to provide the InnerKeySelector/OuterKeySelector as a series of expressions.

    But the solution isn't obvious. Here's his VB expression for a join on City + State composite key:

    Dim query1 = _
        From l In dc.LendingLimits _
        Join p In dc.Properties _
        On New With {l.County, l.State} Equals _
              New With {p.County, p.State} _
        Where p.PropertyId = SearchValue And _
              l.EffectiveDate = TargetDate _
        Select l.Amount
    
    Cool!

    Added: 3/18/2008

    Rob Conery Waxes Enthusiastic over Lambda Functions

    Rob appears to have fallen in love with Lambdas. As he says in his My Personal Lambda Crusade post of March 17, 2008:

    I love lambdas and I’m pretty sure they solve every problem imaginable. Why just the other day my daughter painted her face with leopard spots, using a Sharpie pen, and I said to myself "Rob(x=>x.Beer("immediately"))" and all of a sudden the world was a brighter place…

    His post includes a link to "a very good read." It's Howard Dierking's Lambda, Lambda, Lambda! post of January 18, 2008, which has one of the best explanations of an expression tree I've ever come across. Howard's the Editor-in-Chief of (and tech lead for) MSDN Magazine.

    Added: 3/18/2008

    Jeff Currier Shows Source Code for SQL Server Data Services HttpRequest and HttpResponse Methods

    Jeff's Some SQL Server Data Services Coding Examples post of March 16, 2008 include C# samples for making RESTful HttpRequest.CreateRequest calls that accept URI, HttpMethod, data, and contentType parameters, as well as and reading responses with a custom ReadResponse(HttpWebResponse) method that returns the data as a string.

    A more user-friendly version requests and returns a list of an Authority's Containers that Jeff imports into a LINQ to XML XDocument and binds it to an ASP.NET dropdown list. He then constructs a query of the selected Container and binds a list of entities with Kind = Customers to a GridView control.

    Jeff promises to post a similar demo for SOAP request and response messages as well as for Java.

    (Jeff's originally from the WinFS group. His first blog post is a recommendation to catch the "DAT416  Building on WinFS: Developing a Great WinFS App from Scratch" session from Tech*Ed 2006!)

    Ruurd Boeke Describes How to Build an Entity Data Model Client without an Entity Framework Reference

    His Adding Edit support to businessobjects post of March 16, 2008 says:

    I'm building toward a set of tools that will enable me to use EntityFramework on the server and use the same businessobjects on the client-side, without having to reference EntityFramework at all.

    This first post implements an IEditableBusinessObject, which inherits from IEditableObject. Ruurd uses PostSharp's OnFieldAccessAspect to intercept properties and add their values to the statebag. His "next step will be to get this [object] to serialize nicely, with original values and such."

    For more background on the EDM server side, see the "Ruurd Boeke Adds Complex Types to His IPOCO Entity Framework Implementation" topic of LINQ and Entity Framework Posts for 3/10/2008+.