Happy New Year! This post is updated daily or more often, depending on availability of articles.
Ben Hall Describes Inserting LINQ to SQL Data with Stored Procedures
Others, including Scott Guthrie, have explained how to substitute stored procedures for dynamic SQL when performing INSERT, UPDATE, and DELETE operations with LINQ to SQL. In his January 4, 2008 Custom Insert logic with Linq to SQL post, Ben explains the process for the INSERT method. It's reasonable to expect that posts for UPDATE and DELETE will follow.
David Hayden Adds Custom Dynamic Data Fields to His Tutorial
ASP.NET Dynamic Data Websites - Creating Custom Dynamic Data Fields of January 4, 2008 is the fourth member of David's series. (See the "David Hayden Extends His ADO.NET Dynamic Data Validation Tutorial" topic below for previous members.) A standard set of default dynamic data controls is present by default; David adds the AJAX Control Toolkit's CalendarExtender to enter or edit data values.
Danny Simmons Updates Entity Framework FAQ to Version 0.3
Danny's Entity Framework FAQ (Version 0.3 of 1/4/2008) has nine new entries:
- 7.5 Does the EDM support guids?
- 7.6 Does the EDM/EF support enums?
- 10.3 Can you use a guid property as part of an entity key?
- 10.4 Can I use a server-generated guid as my entity key?
- 18.2 How can I do a filtered load of a relationship?
- 18.3 How can I see the SQL which will be sent to the backend database as a result of my query?
- 20.2 Is it possible to serialize a graph of related entities? Why am I only getting one entity at a time when I do XML serialization?
- 20.3 Is it possible to serialize the ObjectContext?
- 20.4 How do I serialize derived entity types over a WCF service with DataContract serialization?
The additions to sections 18 and 20 clarify significant issues and are very welcome. (See Controlling the Depth and Order of EntitySets for 1:Many Associations of December 20, 2008 for more details.)
2008 Predictions for LINQ, Entity Framework, et al. in Redmond Developer News
The cover story for the January 2008 issue of Redmond Developer News is "Peering into the Future: Experts predict what developers should expect in 2008" by founding editor Michael Desmond. Contributors include Mary Jo Foley, Rockford Lhotka, Jim Payne, Peter Varhol, Johannes Ullrich, William F. Zachmann, and me.
I read the tea leaves for Silverlight 2.0, ASP.NET Data Services, SubSonic, Volta, the "LINQ Blizzard," ADO.NET Data Services, the Dynamic Language Runtime (DLR). If you're interested in these topics primarily, ^F for jennings.
January 1, 2008 is my first anniversary writing for 1105 Media's Redmond Media Group (RMG), who publish Visual Studio Magazine, Redmond Magazine, Redmond Channel Partner, and Redmond Developer News. In honor of the "event," I've posted an updated Visual Studio Magazine Article Retrospective, which displays four years of covers based on stories I've written for VSM.
The Exposing Arbitrary Data [from ANDS] Quartet by Mike Taulty
Mike tests ADO.NET Data Services (ANDS) with the Entity Framework and SQL Server as well as in-memory objects as data sources in these four posts of January 3, 2008:
ADO.NET Data Services - Exposing Arbitrary Data (1) follows the creation of two services (EFService.svc and MemoryService.svc) and use of WebDataGen.exe to create client proxies for the services. As was the case with LINQ to SQL as the data source, you must hack the classes for MemoryService to add missing associations.
ADO.NET Data Services - Exposing Arbitrary Data (2) describes how to implement IUpdatable.Add(), .SaveChanges(), .Attach(), and AddResourceToCollection() for inserting data into MemoryService.
ADO.NET Data Services - Exposing Arbitrary Data (3) provides code to delete an author and associated books with IUpdatable.Delete() on the BookContext class.
ADO.NET Data Services - Exposing Arbitrary Data (4) shows code to update an author and move a book from one author to another.
Mike concludes that IUpdatable needs documentation. (I agree). The examples would have been more interesting if Mike had included unit tests in the code.
If you're interested in duplicating Mike's tests with more complex (i.e., Northwind) in-memory objects, download the JSON vs. XML DataContract Serialization Test Harness, which includes classes and object initializers for 20 Order objects and their associated Customer and Order Details objects.
Guy Burstein Joins Microsoft Israel's Developer & Platform Adoption Group
His I Started Working at Microsoft post of January 3, 2008 says:
In my new job, I will do what I like to do most, which is to keep the Israeli developers community updated with Microsoft's latest technologies, and help customers to choose the best of Microsoft has to offer.
Hopefully, Guy will continue his LINQ and Astoria-related blogging.
Ben Hall Reviews the LINQ Quickly Book
Ben's Linq Quickly: Book Review of January 2, 2008 seems to me to damn the book by faint praise. Ben notes that the book covers LINQ to XSD but his review doesn't mention that LINQ to XSD development stopped at Orcas Beta 1 (see LINQ to XSD Redux and LINQ to Stored XML Coming of December 2, 2007.)
Ben picked up the same .NET Framework version number error (3.0 instead of 3.5) that I did in "Book Review: LINQ Quickly (Packt Publishing)" from LINQ and Entity Framework Posts for 12/17/2007+.
In my view, the book should have been titled LINQ Written Quickly.
Marcelo Lopez Ruiz Posts Simple ADO.NET Data Services Hosting Code
If you prefer self-hosting an ADO.NET Data Service on a fixed TCP port instead of using the Cassini Web server, Marcelo's Fast, simple test app for ADO.NET Data Services post of January 2, 2008 offers a minimalist approach to exposing in-memory data with a C# console app.
Mike Taulty Discovers that NOT NULL Foreign Key Fields Prevent ADO.NET Data Service POST Operations
The Northwind sample database's religious avoidance of applying the NOT NULL attribute to foreign key fields points out a problem (bug?) in .NET Data Services' December CTP.
Mike's ADO.NET Data Services - Inserting Related Entities post of January 2, 2008 demonstrates that you can't execute POST (INSERT) operations with objects that have associated (child) objects and the NOT NULL attribute applied to the foreign key value for the child object when you use LINQ to SQL as the data source.
Failure to provide an appropriate foreign key value violates relational integrity rules and should throw an error for a missing foreign key value.
If you apply the NOT NULL attribute to the foreign key, you receive a server-side error when attempting the POST. Mike says this occurs because he believes the framework:
- Insert[s] the book
- Update[s] the book to set the author id
However, this sequence should throw an error because step 1 violates referential integrity. The QuickStart example, which uses Product and Category objects, appears to insert a new Product object without a problem.
Something strange seems to be going on here.
Mike Taulty Discovers You Can't Trace ADO.NET Data Services' Messages
Because Astoria uses HttpWebRequest directly, not via WCF and HTTP tracing with proxies isn't reliable.
So Mike shows you in his January 2 ADO.NET Data Services - Tracing Messages from Client to Service post how to create a partial class to add a Debugger.Break() to the OnSavingChanges event handler to enable inspecting the Object Context's ObjectStateManager at this point.
Marcello Lopez Ruiz Explains How to Intercept HTTP Internal Server Errors from ADO.NET Data Services
Andy Conrad exposed another ADO.NET "stealth blogger" in his Server errors and the Astoria client of New Years' Eve. This time he's Marcelo Lopez Ruiz, who started blogging in November 2004 when he was an Avalon Test Lead. He joined the ADO.NET team in September 2006 and moved to Project Astoria in July 2007. Marcello's first ADO.NET Data Services blog with sample code is Getting ADO.NET Data Service error details on client of December 31, 2007.
Marcello shows you how to write a simple console app that uses the WebException in conjunction with HttpWebResponse class. Andy says:
One thing I regret that we didn't get into the Astoria December CTP was the ability to show detailed Astoria server errors to remote clients. Something like what ASP.NET supports. That way the developer can see what errors occurred on the server via the web browser. Currently, one has to have a debugger attached to the server process to get the equivalent information. This is particularity interesting in cases where the Astoria server code is not the component throwing the exception - for example when the Queryable provider throws an exception.
In addition, we are also looking at adding a way for providers to map specific exceptions to HTTP errors which could be used by provider writers to specify runtime HTTP errors instead of the generic "Internal Server Error". For example, if there was a database constraint error when inserting some data. Hopefully, this feature will make it into the next beta.
David Hayden Extends His ADO.NET Dynamic Data Validation Tutorial
In a New Year's Day ASP.NET Dynamic Data and Validation Using LINQ To SQL OnPropertyChanging Partial Methods post, Dave describes how to take advantage of LINQ to SQL's OnPropertyChanging partial methods for data validations. His earlier posts on this topic include:
- ASP.NET Dynamic Data Website Getting Started - ASP.NET RAD Development for Data-Driven Websites (see below)
- ASP.NET Dynamic Data Websites - Customizing Pages and Validation
The sixth in the Converting SQL to LINQ series, posted December 31, 2007, tackles LINQ's VB 9.0 expression syntax for cross (Cartesian), inner, natural, and outer joins.
Jonathan Carter Continues His 11-Part ADO.NET Data Services Series
Jon has reached the seventh in his ADO.NET Data Services Training Series that began on December 12, 2007. Jon's a Microsoft evangelist for the .NET Framework and Visual Studio. In an earlier avatar, he was a writer for numerous magazines, so his episodes are more like stories than tutorials. The protagonist is ...
Phillip, who runs a cell phone resale company, and is looking to ramp up his business. Phillip has an extensive database of cell phones, carriers, and manufacturers. Lots of time and effort has been put into the population and maintenance of his precious data. One day he realizes that all that time he put into his database should be making him more money, so he decides to provide access to his data store to other companies looking to build a web presence but don’t have the resources Phillip has.
Here are the "chapters," with links to those complete as of the latest update:
Added and Updated: 1/1/2008
David Hayden on Customizing ASP.NET Dynamic Data Web Sites
In his ASP.NET Dynamic Data Websites - Customizing Pages and Validation post of December 30, 2007, David shows you how Page Templates work, how to customize a ListDetails page, and how validate changes to LINQ to SQL objects' property values.
Free Introducing Microsoft LINQ eBook from Microsoft Press
Introducing Microsoft LINQ is one of the following three eBooks that Microsoft Press is offering as a no-charge dowload:
- Introducing Microsoft LINQ by Paolo Pialorsi and Marco Russo (ISBN: 9780735623910)
This practical guide covers Language Integrated Query (LINQ) syntax fundamentals, LINQ to ADO.NET, and LINQ to XML. The e-book includes the entire contents of this printed book!
- Introducing Microsoft ASP.NET AJAX by Dino Esposito (ISBN: 9780735624139)
Learn about the February 2007 release of ASP.NET AJAX Extensions 1.0, including an overview and the control toolkit.
- Introducing Microsoft Silverlight 1.0 by Laurence Moroney (ISBN: 9780735625396)
Bart de Smet: "Essential LINQ to Objects" in a 19:29 Video Segment
Bart gives a rundown of his early A custom implementation of the .NET Standard Query Operators from LINQ CodePlex project, which implements all LINQ Standard Query Operators (SQOs) in C# 3.0 code with this 20-minute video segment, Essential LINQ to Objects produced for Microsoft BeLux (requires registration.)
Note: The Silverlight video wouldn't play for me with Windows Server 2003 or Vista on 12/31/2007. I'll remove this note when/if the problem goes away.
Pablo Castro Discusses the Idempotence of .NET Data Services
Wikipedia defines idempotence as describing "the property of operations in mathematics and computer science that yield the same result after the operation is applied multiple times." Idempotence becomes an issue in loosely coupled systems that insert data, such as a SOAP or REST Web service that adds a new row to a table by an Insert method or POST operation.
If the underlying tables have identity columns as their primary key, such as the Northwind Orders, Employees, Products, Suppliers, and Shippers tables, they fail the idempotence test because a client that repeats the Insert invocation or POST operation for some reason inserts a new row for each repetition.
A table that relies on the client to supply the primary key value (such as Customers) can be idempotent if server-side business logic or the RDBMS itself refuses repeated updates of the same row and doesn't modify the table in the process.
Pablo's brief Idempotence on HTTP operations post of December 22, 2007 describes the idempotence of .NET Data Services' GET (SELECT), PUT (UPDATE), POST (INSERT) and DELETE operations, as well as its dependence on business rules or the underlying RDBMS's table configuration.
Note: Missed in the December 20+, 2007 post.
Rob Conery Compares NHibernate, LINQ to SQL, and Subsonic as O/RM Tools
Rob's ASP.NET MVC: Choosing Your Data Access Method post of December 14, 2007 is an admittedly biased comparison of the pro, cons and learning curves for three free data access and object persistence tools, two of which (NHibernate and Subsonic) are open source.
The primary topics of the comparison are:
- Domain objects, entities and data access patterns (Active Record, Repository, or Data Broker
- Application and its O/RM tool lifetimes (will support for the O/RM tool be available through the application's full lifecycle)
- Product "vision and approach" or "Why they made it?"
- Ease of use
The post's 32 comments are from NHibernate and Subsonic proponents primarily and are well worth reading. I agree with one commenter (Elmar) that Entity Framework/Entity SQL/LINQ to Entities is more comparable to NHibernate than LINQ to SQL.
Now that ASP.NET MVC is out the door, hopefully Rob will have time to work on LINQ to Subsonic. (See SubSonic will be the "Convention-Driven Toolset for Microsoft’s New MVC Framework" for ASP.NET of November 11, 2007 and ASP.NET 3.5 Extensions Preview Released for more background on LINQ, MVC and Subsonic.)
Added: 1/1/2008; missed in the December 13+, 2007 post.