Wednesday, May 28, 2008

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

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

Les Liaisons Dangereuses

Image courtesy of Julie Lerman, Google, and an attack from a site in the .cn TLD.

Update 5/28/2008: Speaking of attacks from the .cn TLD, check out Wired's Did China's Hackers Shut Off the Lights? article of May 29, 2008 by Noah Shachtman that carries this lead:

Hackers working on behalf of China's People’s Liberation Army have penetrated networks controlling electric power grids in the United States, computer security experts believe. And that may have precipitated a massive blackout on the east coast in 2003, as well as a blackout in Florida this year.

Added: 5/28/2008

Ryan Dunn Explains SQL Server Data Services Plain Old XML (POX) Serialization Scheme

SQL Server Data Services (SSDS) hasn't been upgraded with ADO.NET Data Services' (Astoria's) Atom/AtomPub or JSON wire formats, so you're currently stuck with POX that's similar to what's emitted by the original .NET 1.0 XmlSerializer. (Astoria doesn't support POX, but Pablo Castro once promised it.)

Ryan gives a simple example of deserializing and serializing the POX format to and from a class with the XmlSerializer in his Serialization in SSDS post of May 28, 2008. Serializing is a bit more difficult because the XML is missing the xsi:type element that defines one of the five data types that SSDS currently supports. Ryan ends up using Reflection to get the object's properties and then builds the XElement(s) by hand.

Added: May 28, 2008

More Evidence that the ADO.NET Team is Abandoning LINQ to SQL

Damien Guard's "Short answer: No" comment to the contrary notwithstanding, an anonymous commenter (JD) added on May 28, 2008 the following to my Is the ADO.NET Team Abandoning LINQ to SQL? post:

Further proof: no mention of the released-with-3.5 LINQ to SQL in the prep guide for the upcoming ADO.NET 3.5 certification exam, but there's a full section on the released-post-3.5 entity framework. DUMB.

The "Object Relational Mapping by Using the Entity Framework" topic counts for 11 percent of the overall score for Exam 70-561, Microsoft .NET Framework 3.5, ADO.NET Application Development includes the following subtopics:

  • Define and implement an Entity Data Model.
  • Query data by using Object Services.
  • Map data by using the Entity SQL Language.
  • Access entity data by using the EntityClient Provider.

Added: May 28, 2008

Google App Engine Opens the Gates with Pricing Competitive to or Better than Amazon Web Services

Google's May 27, 2008 Google App Engine to Announce Open Sign-ups, Pricing Plans, and New APIs at Google I/O press release announces that:

Google App Engine is announcing open sign-ups. More than 150,000 developers have joined the product's waiting list over the past 6 weeks; on Wednesday, Google App Engine will be available to everyone -- no waiting required. ...

Google App Engine will provide two new APIs in the coming weeks. The image-manipulation API enables developers to scale, rotate, and crop images on the server, and the memcache API is a high-performance caching layer designed to make page rendering faster for developers.

My Google App Engine Opens to All Comers and Gets Price List post of May 28, 2008 compares Google's posted prices with those for Amazon Web Services: SimpleDB, S3 and EC2. Current CPU usage, data transfer and storage limitations for free services during the preview period will remain in effect until "later this year," when the new pricing for additional capacity will go into effect.

My conclusion: Google is the price leader at the moment and will set the bar for pricing by all cloud service vendors, including Microsoft

Added: May 28, 2008

PDC 2008 to Emphasize The Microsoft Cloud Platform, Live Mesh, SQL Server Data Services and ADO.NET Data Services

Ray Ozzie will keynote Professional Developers Conference 2008 and expand on his MIX 08 keynote about Microsoft's Web-based services.

The initial session list includes the following presentations about the cloud platform, SQL Server Data Services (SSDS), ADO.NET Data Services (Astoria), and Live Mesh synchronization services, including those for Astoria:

  • A Day in the Life of a Cloud Service Developer
  • Architecting Services for the Cloud
  • Developing and Deploying Your First Cloud Service
  • Developing Applications Using Data Services (Astoria and SSDS)
  • Live Platform: Building Mesh Applications
  • Live Platform: Mesh Services Architecture Deep Dive
  • Live Platform: New Developer Services and APIs
  • Logical Queuing: Developing Occasionally Connected Clients
  • Scalable, Available Storage in the Cloud
  • Under the Hood: Architecture of Storage in the Cloud
  • Under the Hood: Building SQL Server Data Services (SSDS)

PDC 2008 will feature 160+ technical sessions plus 11 pre-conference tutorials, including:

NET Data Access from A to Z

Presenter(s): Michael Pizzo, Jose Blakeley

Microsoft® has recently introduced several industry-leading innovations to ADO.NET. These innovations include LINQ to SQL, LINQ to DataSet, and the ADO.NET Entity framework with LINQ to Entities. These technologies are complementary to the existing, familiar ways for accessing data with the ADO.NET foundation such as DataSets and ADO.NET Data Providers. During this A to Z session, Michael Pizzo and Jose Blakeley, architects in the data programmability team at Microsoft, will discuss the motivation and strengths of each technology. After Jose and Michael share their insights and compare and contrast the strengths and goals of these technologies, you will leave this session knowing which data access technology best fits your need; you will also get advice on how, when, and if you should migrate from existing technologies to these new ones.

Building block services are for Microsoft's fledgling Internet Services Bus (ISB) initiative that hosts Windows Communication Foundation-enabled BizTalk services for connectivity, identity and, shortly, workflow as a Software as a Service (SaaS). The following sessions apply to ISB:

  • A Lap Around Building Block Services
  • Architecture of the Building Block Services

MSDN Magazine's recent "Connect Enterprise Apps With Hosted BizTalk Services" article by Jon Flanders and Aaron Skonnard provides an introduction to the ISB and source code for a simple Building Block service. You can sign up for a ISB preview account at the BizTalk Labs site. It wouldn't be surprising to see SSDS and Astoria integrated as Building Block services post-PDC.

Added: May 28, 2008

Steve Naughton Adds Code to Selectively Disable Insert, Edit and Delete Hyperlinks on ASP.NET Dynamic Data Controls

Steve unexpectedly continued his A DynamicData Attribute Based Permission Solution using User Roles project with a Part 6 - Miscellaneous bits post of May 28, 2008, which provides snippets for the following tasks:

  • Disabling Insert hyperlinks on List and Details, etc.
  • Removing; Edit, Delete, Details hyperlinks from Lists

David Ebbo of the ASP.NET Dynamic Data team explains in a Sample: Dynamic Data and attribute based permissions post of May 27, 2008 why role-based permissions weren't provided out of the box:

This is something that we had been thinking about putting in the product early on, but decided against for a couple reasons:

  • This was a short product cycle for us, and we had some pressure to limit the v1 feature set.
  • We were not confident that we could come up with something generic enough to please everyone, so we opted instead to make Dynamic Data extensible enough that the permission system could be implemented on top of it.

Thanks a lot to Steve for coming up with this and taking the time to blog it so thoroughly!

Here's hoping that developers using the scaffold will have heard about Steve's critical addition so they don't need to start from scratch on a critical feature. I'll include a link to Steve's posts in my article about ASP.NET Dynamic Data for Visual Studio Magazine's September issue.

Added: May 28, 2008

LINQ to SQL Advocate Jim Wooley Mulls Over Danny Simmons' "Why Use the Entity Framework" Post

Jim's not sanguine that the entity framework is "a data layer for all seasons" as Danny infers in his Why use the Entity Framework? post of May 17, 2008. Jim says in his Danny Simmons compares the Entity Framework to similar technologies post of May 27, 2008:

[Danny] is indicating that the EF should be the defacto mechanism for building the entity structures around which the various components of your system will be built. Thus one tool to answer the various solutions. Is the EF really the best way to expose relational data from a reporting or analysis perspective, time and performance analyses will tell. He does go on in the comments to his post indicating that he is not necessarily advocating re-using the same entities for all of these various application components, but rather to use a similar tooling to create the potentially separate entities that each subsystem will consume. While it makes the programmatic portion easier, the jury is still out on the other areas.

I'm still getting up to speed on the EF, but do have concerns regarding the POCO (Plain Old Class Objects) story and some of the other requirements that the EF puts on your entity and database models.

My take is that the combination of EF's EntityClient and Entity SQL has the potential to create a truly vendor-agnostic front end for all RDBMSs for which an EF-enabled ADO.NET Data Provider is available. The Canonical Command Tree translates Entity SQL queries into the selected RDBMS's SQL dialect. By EF's RTM, all major commercial and most open-source databases will be EF-compatible. The Object Services layer, which introduces a significant performance hit and would impede reporting and analysis operations by delivering objects, is optional.

The question is whether Microsoft will open SQL Server Reporting Services and Analysis Services/BI to other back-ends via the Entity Client/Entity SQL combination. Perhaps we'll be able to find out from Mike Pizzo or Jose Blakeley in October at PDC 2008's .NET Data Access from A to Z pre-conference tutorial.

Added: May 28, 2008

Marcelo Lopez Ruiz Explains Breaking Changes to the Syntax of ADO.NET Data Services Query Interceptors

Query interceptors return a predicate expression instead of an IQueryable<EntityType> and no longer take arguments, according to Marcelo's Query Interceptor changes for ADO.NET Data Services post of May 27, 2008. The interceptor returns a lambda expression instead of the result of a LINQ where query. Here's the reason for the change:

Why did we make this change? One of the main reasons is that this allows us to run query interceptors on $expand segments in addition to the regular paths. So for example if you query for /Customers?$expand=Orders, then any query interceptors on Orders will also run, giving a consistent view of the data in the service to its clients.

Added May 27, 2008 16:20 PST

Mike Taulty Finds User Authentication for ADO.NET Data Services to be More Complex Than Expected

Mike's Authenticating with ADO.NET Data Services post of May 27, 2008 begins with the assumption that, because Astoria uses HTTP, IIS and Windows Communication Framework (WCF), user authentication can take advantage of in-built services. The problem is that IIS's basic, digest, NTLM, Windows and certificate authentication schemes are wired to Windows credentials.

Mike settles on anonymous IIS access with ASP.NET authentication for the Astoria service. He then sets up his client to use Forms authentication on the Services page of the project's Properties window. Finally, Mike hooks the BeforeSendingRequest event to manage the AuthenticationCookies:

And I am "in business" :-) I have my server-side code doing authentication based on ASP.NET membership, I have my client side code using that same membership system to authenticate its requests into that service and I have an entirely pluggable credential validation mechanism for the back-end.

He then tackles the same process from Astoria's AJAX client from CodePlex and concludes:

Of course, the next question is what to do about authorisation?  but that's another story.

Use LINQ to Simplify Selecting Items From ASP.NET ListBox's ListItemsCollection

Devprise's Querying Selected Items From ListItemCollection Using Lambda Expressions post of May 27, 2008 compares conventional foreach, foreach with yield, a simple LINQ query expression with a where clause, and a LINQ Where method call query to add selected items to a generic List<ListItems> collection.

Alvin Yong Recommends Lightweight DTOs with LINQ to SQL or Entity Framework in n-Tier Scenarios

Alvin suggests in his LINQ for n-Tier Architecture post of May 27, 2008:

... creating lightweight data transfer objects or DTOs which are hydrated from LINQ entities. These objects will contain enough information to populate controls on a page and later are used to encapsulate data which should be sent back to the database.

This strategy worked beautifully from the perspective of using LINQ to interact with the database. The DTOs were simple to write and where they really excelled at was “flattening” of data from related entities. They really shone for containing data that spanned different entities!

He says he "will post more on this architecture later" when he has more free time.

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.

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

0 comments: