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

Sunday, October 25, 2009

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

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

Entity Framework and Entity Data Model (EF/EDM)

Julie Lerman created a Screencast – What’s new in the Entity Data Model Designer in VS2010 and posted it on 10/23/2009. Here’s her description and a link to view it:

I have created a screencast showing some of the best new features of the new Entity Data Model Designer. This is using the new Beta 2 version of Visual Studio 2010.

The screencast is about 20 minutes long.

This is not designed to be an introduction to building models. Rather, it specifically highlights (and demonstrates) the improvements, so should be of great interest to those who have been using the designer or possibly looked at in the past and said “meh” and walked away.

In the video, I go over:

  • EDM Wizard naming the entities with proper plural and singular names and a few minor issues
  • Impact that Foreign Keys has on Association Mappings
  • Creating complex types
  • Mapping Insert/Update/Delete Stored procs to entities with Complex Types
  • Creating functions from Stored Procedures that return results which do not map to an entity
  • Quick look at Model First Design

There are more new goodies in the designer, just couldn’t cover them all in one shot!

You can also find the screencast at http://www.screencast.com/users/JulieLerman/folders/EF4

Gil Fink offers on 10/21/2009 his ADO.NET Entity Framework Session Slide Deck:

Two days ago I had a half day session at Microsoft [Israel] about Entity Framework. The agenda was as follows:

  • Entity Framework Introduction
  • Exploring the Entity Data Model
  • Querying and Manipulating Entity Data Models
  • Customizing Entity Data Models Examples
  • EF4

As I promised the slide deck and demos can be downloaded from here. I want to thank the attendees of the session and I hope you had great time like I did.

Also, I’m sorry for the late publishing but it was caused by technical problems
to upload the files into the blog’s server. Instead I put it in my Skydrive.

P.S – in order to use the demos you need to restore the added database
backup and replace all the connection strings in the demos to point to
the database you restored.

Jeffrey Schwartz reviews Entity Framework’s speckled history in his EF4 Beta 2 Arrives with New Features article for 1105 Media’s Data Driver column of 10/21/2009:

The big news for .NET developers this week is the release of beta 2 of Visual Studio 2010 and the .NET Framework 4, which became generally available today (see VS2010 and .NET 4 Beta 2 Go Live). For developers of data-driven applications, beta 2 included some major improvements to the ADO.NET Entity Framework, Microsoft's new interface for providing access to apps using object-relational modeling (ORM) rather than programming directly against relational schema.

First released with the Visual Studio 2008 and the .NET Framework 3.5 SP1, the Entity Framework has become a polarizing issue among database developers. As covered extensively, the Entity Framework has been a godsend to many programmers who welcome the move to model-driven development.

However it has also been much maligned by those who prefer the tried-and-true ADO.NET data access mechanism or those who feel that there are better object-relational mapping technologies than Microsoft has to offer such as the Nhybernate or Spring.NET.

Nonetheless Microsoft's Entity Framework stands out in another unique way: it is part of Visual Studio and the .NET Framework. And like it or not, it's here to stay. …

Gil Fink’s Calling User-Defined Functions (UDFs) in Entity Framework post of 10/20/2009 describes his response to a forum question:

Yesterday I answered a question in Entity Framework forum in regard of how to use User-Defined Functions (UDFs) in Entity Framework. This post holds the answer.

The Problem

I have a UDF in my database that I want to use with Entity Framework. When you use the Entity Data Model Wizard you can surface the function in the SSDL. When you will try map the created function element to a FunctionImport you’ll get the following exception: ”Error 2054: A FunctionImport is mapped to a storage function 'MyModel.Store.FunctionName that can be composed. Only stored procedure functions may be mapped.”
So how can we use the UDF?

Gill provides the answer.

Matheiu Mezil’s Entity Framework: the productivity way post of 10/20/2009 details gaining productivity with T4 templates:

One of the best points with Entity Framework is the developer productivity gain. If you associate EF with the T4 template code generation, this gain explodes. Imagine that we want a WCF service which exposes some data. For each entity type, you probably want a Get method which returns the entities, perhaps another Get which takes the entity id as parameter and which returns the entity with its relationships, a Add, a Update, perhaps a Delete.

EF allows an important productivity gain for the entities development and their use. However, in our case, to code to write is almost the same for each entity type. It means that it’s time to use the T4 template.

In all T4 samples I studied, this great template is used only for the entity generation. We will try here to go ahead. …

Kati Iceva’s and Noam Ben-Ami’s New features in Entity Framework impacting providers post of 10/22/2009 warns:

Providers for Entity Framework 3.5 will work unmodified against Entity Framework 4.0. Also, most of the features and improvements introduced in Entity Framework 4.0 will just work against an Entity Framework 3.5 provider. However, there are several features that require provider changes to be enabled. Below is a list of these features along with short description of the changes required to enable them.

New features in Entity Framework Runtime impacting providers

  • New EDM (Canonical) Functions
  • Date/Time functions
  • Math Functions
  • Aggregate functions
  • String functions

Considerations for Implementing New Features

Exposing provider functions in LINQ To Entities ()

  • Which functions to expose?
  • Overloads – Provide enough for pleasant user experience
  • Proxies Implementation
  • Translating String.StartsWith, String.EndsWith and String.Contains to LIKE in LINQ to Entities

New Features in Entity Designer Impacting Providers

  • Model First

Elisa Flasko posted a detailed UPDATED WIKI: Home item on 10/19/2009 to the ADO.NET Entity Framework & LINQ to Relational Data (a.k.a. AdoNetEfx) blog containing detailed links in the following categories:

  • Entity Framework Toolkits & Extensions
  • Entity Framework Samples
  • LINQ to SQL Samples
  • Entity Framework Learning Tools

Thanks, Elisa!

LINQ to SQL

See the “LINQ to SQL Samples” category in Elisa Flasko’s post above.

Jim Wooley explains Setting DataContext Connection String in Data Tier in this 10/21/2009 post:

LINQ to SQL offers a quick mechanism to build a data tier in a n-Tier application. There’s a challenge when using the DBML designer in a Class Library. The designer stores the connection string in the Settings file. Although it appears that you can change it in the config file, any changes you make there will be ignored because they are actually retained in the generated Settings file.

While you could go into the DataContext’s .Designer file and change the location of the connection string, any changes you make there will be overwritten if you make changes to the DBML file. So what are you to do?

Jim continues with a detailed solution.

LINQ to Objects, LINQ to XML, et al.

Florent Clairambault’s LINQ : Join with multiple conditions of 10/21/2009 explains:

I wanted to some simple join in LINQ on multiple criteria. And coming from standard SQL it’s not as straightforward as I thought it would be. The little disturbing thing is that you lose auto-completion.

Eric continues with SQL and LINQ syntax examples.

Beth Massi’s SDC 2009 Recap & Surprise post of 10/20/2009 begins:

SDC09 has been a blast. I just finished my last session on Building Office Business Applications with Visual Studio 2010 and I think it went well. We created an OBA for good old Northwind Traders. I migrated the 2008 code which is here on code gallery into VS 2010 and showed the new features of VS2010 that makes Office development easier focusing on RAD data binding (including WPF) and designers, new multi-project deployment, and SharePoint 2010 tools. …

I also did a talk on using Open XML and LINQ to XML to manipulate Office 2007 document formats.

And ends with an admission that October 20 is Beth’s birthday. Happy Birthday, Beth!

Deborah Kurata explains Populating a DataGridView from Xml Data in this 10/20/209 post:

If you are using XML in a WinForms application you may find the need to display the XML data in a DataGridView.

Let's take this XML:

<states>
    <state name="California">
        <abbreviation>CA</abbreviation>
        <year>1850</year>
        <governor>Schwarzenegger</governor>
    </state>
    <state name="Wisconsin">
        <abbreviation>WI</abbreviation>
        <year>1848</year>
        <governor>Doyle</governor>
    </state>
</states>

Displaying XML in a DataGridView sounds easy, but if you just set the DataGridView DataSource to the XML data, you will get something like this:

image

Notice how it has lots of yuck in it: attribute details, node properties, and so on for every node in the XML. So how do you get something more like this:

image

The trick is to use anonymous types.

Deborah then shows you how to “use anonymous types.”

ADO.NET Data Services (Astoria)

Alex James explains Using Data Services over SharePoint 2010 – Part 1 – Getting Started in this detailed 10/21/2009 post:

ADO.NET Data Services 1.5 and SharePoint 2010 allow developers to write applications against SharePoint Lists using the familiar Data Services Client programming model.

Setup

The SharePoint 2010 beta will become generally available in November.

In order to use Data Services with SharePoint 2010 Beta, ADO.NET Data Services 1.5 must be installed on your server *before* you install SharePoint 2010.

And then to program against a Data Services enabled SharePoint box you need either:

  • VS 2008 SP1 with the ADO.NET Data Services 1.5 installed (CTP 2 or higher) or
  • VS 2010 (Beta 2 or higher)
Where is your Data Service Endpoint?

Assuming you’ve got everything setup and working the first thing you need to know is where your Data Service endpoint is installed.

If your SharePoint site is http://mflasko-dev/ (thanks Mike) then your Data Services endpoint will be http://mflasko-dev/_vti_bin/listdata.svc.

If you open one of these endpoints up in Internet Explorer you’ll see something like this:

DataServiceRoot

As you can see this is a standard Data Services Atom feed, listing all the Lists on the SharePoint site.

Cool.

Once you know where your Data Service is located, the next step is to write your Data Services Client application.

Alex continues with code for a sample Astoria client.

ASP.NET Dynamic Data (DD)

No significant new posts found this week.

Sunday, September 27, 2009

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

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

Entity Framework and Entity Data Model (EF/EDM)

Nikolaos Kantzelis dives into ASP.NET 4.0,SEO and meta tags in this 9/27/2009 post:

I am thinking to create a new series of posts regarding ASP.NET and SEO (Search Engine Optimisation). I am going to start with this post, talking about some new features that make our asp.net apps more SEO friendly. At the end of the day, there is no point having a great application and somehow “scare” the search engines away. This is going to be a short post so let’s quickly have a look at meta keywords and ASP.NET 4.0.

Evolutionary Geek’s Pre-Generating Entity Framework Views with Embedded Metadata post of 9/24/2009 covers this problem and its solution:

Problem: When you are using embedded metadata in your Entity Framework project, the MSDN topic for How to: Pre-Generate Views to Improve Query Performance (Entity Framework) comes up short.

Solution: This posting shows a simple (if tedious) technique for working with both embedded metadata and the pre-generated views.

Alex James continues his Entity Framework Tips series with Tip 36 – How to Construct by Query of 9/23/2009:

While writing my tips series and writing EF controllers for MVC I found that I regularly wanted to create and attach a stub entity.

Unfortunately it isn’t quite that simple, you have to make sure the entity isn’t already attached first, otherwise you’ll see some nasty exceptions. …

And concludes:

Again I’ve demonstrated that mixing EF Metadata and CLR Expressions makes it possible to write really useful helper methods that take a lot of the pain out writing your apps.

Mike O’Brien’s Linq to Entities Query Visualizer post of 9/22/2009 points to Raja Venkatesh’s LINQ to Entities query visualizer download:

image

LINQ to SQL

Simon Segal’s A Linq To SQL Saga Persister for NServiceBus post of 9/22/2009 posits:

NServiceBus is becoming a very popular Open Source development framework and out of the box it supports some very elegant feature extensibility points (thanks Udi) that have been designed very deliberately in a technology agnostic way. This allows us as developers to write our own implementations of certain features in the technology of our choice, and the subject of this post focuses on extending the Saga Persister. However at this point let me just say that it may well be worth your while to read Udi’s post on Saga’s before continuing and then come back here to finish.

Eric J. Smith and Shannon Davidson explain in LINQ to SQL - Detach Entities how to “Easily detach entities when using LINQ to SQL”:

How do I use disconnected entities with LINQ to SQL? Every developer that has used LINQ to SQL has asked this question in dismay. Where is the detach? How do I use these entities with services, JSON, encapsulation, and multiple data contexts? All are normal questions when building a solid framework. By default, LINQ to SQL does not like to let go of its entities and does not see a reason that an entity should be disconnected from its context. PLINQO makes it very simple to detach LINQ to SQL entities. We are going to walk you through how this was implemented in PLINQO by showing how to manually add the detach functionality using LINQ to SQL.

Joydip Kanjilal confuses LINQ to SQL with LINQ to Objects in his Guidelines and Best Practices in Optimizing LINQ Performance article for ASP.NET Pro magazine’s September 2009 issue:

Language Integrated Query (LINQ) is a query execution pipeline for use in the managed environment of .NET Framework. In essence, LINQ is Microsoft's object relational mapper between your business objects and the underlying data sources and provides a simplified framework for accessing relational data in an object-oriented fashion.

Although LINQ is great in the sense that you can query data in your object model seamlessly, there are certain factors that you need to consider to ensure that your application performs to the extent you need it to. This article takes a look at some of the best practices that you can follow for enhancing the performance of LINQ in your applications.

LINQ to Objects, LINQ to XML, et al.

DevExpert explains Implementing a LINQ version of SQL’s LIKE Operator in this 9/25/2009 post:

One of the requirements of one of my recent projects was to implement a search page which allowed the user to enter a search term that supported wildcards.  The search term could contain any number of wildcards in any position within that term.

If you’ve done anything like this before, you probably know there’s nothing built-in to LINQ that supports this type of behavior.  Sure, you could use a combination of String.StartsWith, String.EndsWith, or String.Contains, but this could quickly become too cumbersome if there are many wildcards and/or they are scattered throughout the search term. …

Damien Guard’s When an object-relational mapper is too much, DataReader too little post of 9/22/2009 begins:

I fired up Visual Studio this evening to write a proof-of-concept app and found myself wanting strongly typed domain objects from a database but without the overhead of an object-relational mapper  (the application is read-only).

One solution is to write methods by hand, another is to code generate them but it would be nice to be able to do:

var customers = new SqlCommand("SELECT ID, Name FROM Customer", connection)
  .As(r => new Customer { CustomerID = r.GetInt32(0), Name = r.GetString(1) }).ToList();

So for any DbCommand object you can turn it into a bunch of classes by specifying the new pattern.

Damien then shows you the tiny helper class for “the new pattern.”

Beth Massi explains Mail Merging Into a Single Word Document Using XML Literals in this 9/23/2009 post:

With the release of Microsoft Office 2007 we can work with a much simpler, standard, XML format called Open XML which opens the door for many types of applications that cannot work via COM. What if you needed to build a scalable web service that processes many documents in high volume? What if you wanted to quickly read or write to these formats from a client application but wanted to have minimal dependencies on other applications? These types of programs do not want to require Microsoft Office be installed to run. The cool thing is you have the tools already with Visual Basic 2008. XML Literals are an easy way to manipulate any kind of XML, including Open XML.

She continues with Merging Text & Photos into a Word Document using Open XML SDK of 9/24/2009:

Yesterday I posted about how we could create a letter generator (mail merge) that took data from a database to create a Word 2007 document using the System.IO.Packaging class. I showed how to take data from Northwind using a single LINQ query to create XDocument objects representing letters to customers and then create a single document of all the data using XML Literals.

Today I want to show how we can embed images into the documents as well as text. Since we’re using Northwind for this example, we’ll use the Employee.Photo field from that database.

ADO.NET Data Services (Astoria)

No new articles of significance this week.

ASP.NET Dynamic Data (DD)

Chris Swain’s Distracted by Dynamic Data post of 8/4/2009, which I missed at the time, begins:

Lately my work has kept me so busy I haven't had time to do much with Tank Wars and Silverlight in general.  However, my work project is out on the fringe of Microsoft's latest technology using ASP.NET Dynamic Data.  There are lot's of posts out there on the basics of this new approach at data driven web site development, so I won't bother to cover them.  If you need a place to start, check out the Dynamic Data site. 

While this is a nice new tool to help us rapidly create data driven web sites, it is still a relatively new tool.  As such, it has some bugs and oversights that have yet to be addressed.  I wanted to cover a couple of these in this post.

Sunday, August 23, 2009

LINQ and Entity Framework Posts for 8/17/2009+

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

Entity Framework and Entity Data Model (EF/EDM)

Julie Lerman’s Languages in the 2nd Edition of Programming Entity Framework post of 8/20/2009 explains that to keep her second edition to 800 pages that she’ll need to excise the VB code samples from the text. I did the same in my forthcoming Cloud Computing with the Windows Azure Platform title for Wrox, although in this case the print version is 300+ pages.

Don’t miss the Giant Puppy Pics of Sampson that Julie added on Sunday.

Jonathan Bruce reports Released! ADO.NET Entity Framework Support for Oracle on 8/13/2009:

I am happy to announce that we’ve released our GA for Connect for ADO.NET 3.3! This includes our support for the ADO.NET Entity Framework for Oracle and a host of enterprise-ready features that will greatly enhance your makes EF deployment on your Oracle systems.

Let us know what you think (comment below) and go grab a copy of our trial so you can get started today!

Julie Lerman’s More on Oslo & Data Programmability merger post of 8/20/2009 reports:

Well, the merger was actually much bigger than just Oslo and DP. The entire Connected Systems team and Storage Platforms team (think of that as SQL, with Data Programmability inside of SQL, not DevDiv as one might think) came together.

And it was not a matter of one team being absorbed by another.

A whole new group was created: The Business Platform Division.

Beth Massi explains Using the ReportViewer with ADO.NET Data Services and Entity Framework in her 8/19/2009 post:

If you’ve ever tried to use the ReportViewer to design a client-side report with an ADO.NET Data Service data source (or use an Entity Data Model directly) you may be disappointed. If you try to design a new report, the wizard may crash Visual Studio when selecting an entity. Yikes!

Fortunately, she provides the workaround.

Muhammad Mosa’s Multiple database support with Entity Framework post of 8/18/2009 begins:

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the under[l]ying database provider. In this post I’m going to show how to build an application that support[s] multiple databases using same conceptual model made by Entity Framework.

Alex James continues his EF tips with Tip 33 – How cascade delete really works in EF post of 8/18/2009 which contains these three “golden rules:”

  1. If you add an Cascade delete rule to the model, you MUST have a corresponding DELETE rule in the database.
  2. If you absolutely insist on breaking rule (1) for some reason, Cascade will only work if you have all the dependents loaded in memory.
  3. (2) is *not* recommended!!!

LINQ to SQL

Jim Wooley’s Generating Interfaces for LINQ to SQL Entities post of 8/17/2009 shows you how to customize Damien Guard’s L2ST4 code generation template to toggle creating of interfaces for LINQ to SQL columns.

LINQ to Objects, LINQ to XML, et al.

Nikhil Kothari borrows an earlier LINQ provider name in his BLinq - Linq to Bing Search APIs post of 8/22/2009 (Thanks to Scott Guthrie for the heads-up.):

This post introduces a small sample I'm calling BLinq, which allows you to use LINQ to search for pages and images using the Bing search API... as a first step leading up to some .NET RIA Services integration.

As part of validating and playing with some of the extensibility features in .NET RIA Services, I needed to write a LINQ provider. This was also a good opportunity to delve into some of the deeper technical aspects of the IQueryable construct, expression trees and related concepts, which I had not gotten into first-hand until now. For my prototyping, I decided to write a LINQ provider for querying Bing to search for pages and images. This post will focus on using the LINQ provider itself, and seeing it in action, and in my next post I'll tie it all back to .NET RIA Services. I am calling this BLinq. :-)

… BingContext is very much like a Linq-to-SQL DataContext. It has a Pages property of type IQueryable<PageSearchResult> (ala a Table<T> in a DataContext). Of course this is LINQ, and so you can use standard LINQ constructs like Skip and Take for example to page over the search results. …

Polita Paulus introduced Blinq at Lang.NET 2006: 2006 Lang .NET Symposium to Expose Blinq for ASP.NET (6/19/2006). BLinq later inspired the development of ASP.NET Dynamic Data. Click here for all of this blog’s earlier Blinq posts. To prevent conflicts with earlier use of Blinq, this blog will refer to Nikhil’s app as LINQ to Bing.

Dan Vanderboom’s Strongly-Typed, Dynamic Linq Order Operator post of 8/20/2009 notes:

This morning I ran into a question about my dynamic Linq sort, solved and answered by “Ch00k”, allowing one to get compile-time checking of identifier names.  Well done!

LinqMaster explains How to Use LINQ OfType<> in this brief post of 8/23/2009:

LINQ OfType<> is a useful filtering function for returning items in a collection which match a specific type (or base type). An example might be for getting base items from a listbox of combobox.

An example without OfType:

ColorWrapper x = combo.Items.Where( obj => obj is ColorWrapper ).Cast< ColorWrapper >().FirstOrDefault(cw => cw.Color == value);

An example of LINQ OfType:

ColorWrapper y = combo.Items.OfType<ColorWrapper>().FirstOrDefault(cw => cw.Color == value);

Deborah Kurata describes Adding Nodes to an XML String with LINQ to XML in this 8/20/2009 post. She also offers Anonymous Types: An Introduction and Processing Files Using Anonymous Types posts of 8/19/2009.

Eric White’s DescendantsAndSelfTrimmed LINQ to XML Axis Method post of 8/19/2009 begins:

There are some circumstances where I need a variation on the DescendantsAndSelf axis method that allows me to specify that specific elements (and the descendants of those elements) are ‘trimmed’ from the returned collection.  One of the things that's great about LINQ to XML is the ease with which we can create specialized axis methods when necessary.

Here is the scenario: Open XML contains paragraphs that contain runs. A run can contain a picture that contains a text box, which itself contains a paragraph. When I want to write a transform for paragraphs that are children elements of the w:body element, I want to disregard any paragraphs that are children of contained text boxes.

ADO.NET Data Services (Astoria)

Claudio Caldato’s A new bridge for PHP developers to .NET through REST: PHP Toolkit for ADO.NET Data Services post of 8/21/2009 to the Interoperability@Microsoft blog begins:

Today, I’m excited to announce that we are releasing a new project that bridges PHP and.NET.

More precisely, we are releasing today the PHP Toolkit for ADO.NET Data Services which makes it easier for PHP developers to take advantage of ADO.NET Data Services, a set of features recently added to the .NET Framework. ADO.NET Data Services offer a simple way to expose any sort of data in a RESTful way. The PHP Toolkit for ADO.NET Data Services is an open source project funded by Microsoft and developed by Persistent Systems Ltd. and is available today on Codeplex: phpdataservices.codeplex.com.

Julie Lerman says “Yesterday I blogged that my client is writing a PHP app that hits an Astoria service that I built for them” in her Great timing! PHP toolkit for Astoria, err, ADO.NET Data Service post of 8/21/2009. She discovers how to use the “\” escape character in What I learned about PHP today of 8/20/2009.

ASP.NET Dynamic Data (DD)

No significant new articles for this topic as of 8/23/2009 11:30 AM PDT.

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

No significant new articles for this topic as of 8/23/2009 11:30 AM PDT.

Saturday, July 11, 2009

LINQ and Entity Framework Posts for 7/6/2009+

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

Entity Framework and Entity Data Model (EF/EDM)

Gunnar Piepman explains Entity Framework 4.0: How to use POCOs in this 7/11/2009 post:

Entity Framework 4.0 will provide us with POCO support. That’s good because Entity Framework supports more inheritance mapping strategies than LINQ To SQL but currently it doesn’t support POCOs. To try out Visual Studio 2010 and ASP.NET 4.0 new features I started writing simple photo gallery web application. Today I got my first simple POCOs work with Entity Framework 4.0. As a first thing let’s see my two classes – Album and Photo. …

James Newton-King’s ADO.NET Entity Framework support accidently added to Json.NET post of 7/10/2009 starts with:

I sat down today resolved to finally add support for serializing ADO.NET Entities objects… and instead I came away surprised to find that it already worked. My initial “Lets prove it breaks first and then fix it” test passed first time and it wasn’t until I debugged through the test that I was convinced NUnit wasn’t the one that was broken.

James made his test with an Entity Data Model of Folder and File entities.

Tony Sneed lists the Top Ten New Features in Entity Framework 4.0 in this 7/9/2009 post.

Beth Massi explains Implementing Validation in WPF on Entity Framework Entities in this detailed 7/7/2009 post:

I’ve blogged before about implementing validation on LINQ to SQL classes as well as how to customize the display of error messages in WPF. In this post I want to show how you can use these same techniques to validate entities coming from the Entity Framework (EF). Like LINQ to SQL classes, Entity Framework entities are implemented as partial classes so that you can extend them with your own code on top of the code that the designers generate for you. You can extend EF entities in a similar way as LINQ to SQL classes.

Rowan Miller writes in his Entity Framework (EF) – Events post of 6/28/2009:

In this post we are going to take a look at some of the events that are raised by various parts of the Microsoft ADO.NET Entity Framework (EF). I’m using the recently released Beta 1 of Visual Studio 2010 / .Net Framework 4.0 for this demo but most of the information also applies to the first version of EF released in .Net Framework 3.5 SP1. 

Thanks to Diego Vega for the heads up.

Chris Cluss explains How to use HierarchyID in LinqToSQL or Entity-Framework // MSSQL Server 2008 in this 5/31/2009 post that I missed earlier.

LINQ to SQL

Deepak Kapoor shows you how to Insert Master Detail Data With LINQ To SQL in this 7/8/2009 post.

Waqas Ahmed explains Data Access with ADO.NET 3.5 – LINQ to SQL in this 7/4/2009 post.

Chris Cluss explains How to use HierarchyID in LinqToSQL or Entity-Framework // MSSQL Server 2008 in this 5/31/2009 post that I missed earlier. Repeated from the “Entity Framework” section.

LINQ to Objects, LINQ to XML, et al.

Jonathan Aneja describes techniques for Dynamic Searching using LINQ - Dataset + Joins in this 7/10/2009 post:

About two years ago I posted some code that shows how to dynamically construct LINQ queries at runtime.  On average there's a couple questions per month about trying it in some edge case, and usually the support already exists within the API.  Recently though someone posted a question that has to do with Datasets and Joins that raised some interesting issues. …

Eric White explains Document-Centric Transforms using LINQ to XML in this 7/9/2009 post:

When thought of in a certain way, XML documents come in two flavors – data-centric and document-centric. Further, there are two types of document-centric documents. This post presents my thoughts about approaches to various types of document-centric transformations – data-centric to document-centric, document-centric to data-centric, and document-centric to document-centric. Then, I’ll tie my thoughts back to Open XML transformations.

ADO.NET Data Services (Astoria)

Nuno Filipe Godinho writes in his Data Services – Can be ADO.NET or SQL – What’s the difference post of 7/7/2009:

Just a while ago I was talking about Data Services and suddenly a confusion between ADO.NET Data Services and SQL Data Services took place, because we were talking about different Data Services, and so in order to try to clarify the differences I remembered to write this post.

Nuno’s wrote his post before SQL Data Services was rechristened SQL Azure Database.

ASP.NET Dynamic Data (DD)

Steve Naughton’s Dynamic Data Custom Field Template – Values List post of 7/9/2009 begins:

Here I have created a simple FieldTemplate for a recent project to allow you to give the user a predefined set of text values to choose from without a FK field relationship. An example of this could be a field with optional values of ‘Y’, ‘N’, ‘N/A’ or ‘Y’, ‘N’, ‘Other’ etc.

And continues with sample code to implement the Values List feature.

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

Scott Guthrie celebrates Silverlight 3 Released on 7/10/2009, along with Visual Studio Tools for Silverlight 3 and Expression Studio 3.

Saturday, July 04, 2009

LINQ and Entity Framework Posts for 6/29/2009+

Note: This post is updated with a frequency that depends on the availability of new articles.

Entity Framework and Entity Data Model (EF/EDM)

Danny Simmons continues his DPMud series with D3: Building Great Software is a Battle, Don’t Leave Any Assets on the Sidelines of 6/30/2009. His list of assets is:

  • Analysis Tools
  • Check Constraints in the DB
  • Unit Testing Your Brains Out

Matthieu Mezil says T4 for View Generation is “easier to use than EdmGen” and “it allows you to use embedded metadata artifacts” in this 6/29/2009 post, which includes extensive source code.

Julie Lerman reports Oracle Woos Microsoft OracleClient users in this 6/29/2009 post:

Although Oracle has long had an area of it’s website dedicated to it’s .NET provider, ODP.NET, they have recently added a page specifically for users of Microsoft’s soon-to-be deprecated System.Data.OracleClient:    ODP.NET for Microsoft OracleClient

No mention of EF support yet, not even in the new features list for the ODP.NET 11g Beta (11.1.0.7.10).  I’ll be watching Oracle’s .NET evangelist, Christian Shay’s, blog for more details.

I reported in my Entity Framework Beta 3 Available for Download post of 12/6/2007 that:

Christian Shay, Product Manager in the .NET and Windows group at Oracle left this comment to my Future LINQ to SQL Support for Multiple Databases? post on May 31, 2007:

I think Oracle is keeping their level of support secret. But, a clue has just been revealed and apparently, more will be known at TechEd. Oracle is co-presenting a talk called "ADO.NET Entity Framework: Provider Model and Integration with Third-Party Databases" Check it out: http://cshay.blogspot.com/2007_05_01_archive.html.

EF support by Oracle appears to have died immediately after Christian posted his comment.

See also my Entity Framework Updates post of 6/2/2007.

Elisa Flasko’s Entity Framework Provider for Synergy DBMS post of 7/1/2009 links to Synergy.de’s announcement page about the release: Synergex Announces the Release of the Synergy/DE Data Provider for .NET of 6/19/2009. 

LINQ to SQL

Rob Conery announced SubSonic 3.0 is Released on 7/3/2009. What’s new in v3.0:

And:

LinqMaster shows you How to Create T-SQL CASE Statements With LINQ To SQL in this 6/29/2009 post.

LINQ to Objects, LINQ to XML, et al.

Deborah Kurata attacks the VB’s line continuation character in VS1008 with LINQ to XML literals in the XML Literals: Simplifying Strings post of 7/3/2009 to her new Deborah’s Developer MindScape blog.

Her LINQ: Defining a List of Integers post of the same date simplifies the process with, for instance, Enumerable.Range(1, 9).ToList(). XML Literals: Creating an XML File of 7/2/2009 explains how to do it.

Jim Wooley’s Iterators OR Excuse me waiter theres a goto in my C sharp post of 6/29/2009 begins:

At Codestock '09, I gave my LINQ Internals talk and had a number of people express shock when I showed the underlying implementation of their beloved iterators when looking at the code through Reflector. Let's look first at the C# that we wrote. This is similar to the implementation of LINQ to Object's Where method as shown in the sequence.cs file that's part of the C# Samples.

Eric White’s Querying LINQ to XML Nodes in Reverse Document Order with Better Performance post of 6/24/2009 begins:

Occasionally I need to query LINQ to XML nodes in reverse document order. I’m currently writing some LINQ to XML queries over Open XML documents where I need to select paragraph nodes based on content in the immediately preceding paragraph. However, nodes in LINQ to XML are forward-linked only. We can see evidence of this in the XNode.NodesBeforeSelf and XElement.ElementsBeforeSelf methods – these methods return collections of nodes in document order, not reverse document order. This was by design – LINQ to XML was designed to provide great performance for the vast majority of scenarios with the minimum memory footprint possible. The need to process nodes in reverse document order is rare, so the designers of LINQ to XML decided that it was more important to reduce memory footprint than to allow for good performance in the few scenarios that require processing in reverse document order, and of course it was a good decision. But the need does exist.

ADO.NET Data Services (Astoria)

No significant new Astoria posts as of 7/4/2009.

ASP.NET Dynamic Data (DD)

Peter Blum’s How Dynamic Data changes how you build web forms detailed post of 7/1/2009 describes how DD enables Separation of Concerns:

ASP.NET Dynamic Data emphasizes “separation of concerns” where business logic is separated from the web form. In addition, the web controls showing and validating data are shared by all web forms, providing a consistent user interface. It internally handles database interaction, so you don’t have to write code to create, read, update, or delete records (often known as “CRUD”).

Scott Hanselman called Peter’s post “fantastic” in a recent Tweet.

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

David Ebbo’s T4MVC 2.2 update: Routing, Forms, DI container, fixes post of 6/30/2009 is a continuation of these previous MVC with T4 Templates posts:

  • A new and improved ASP.NET MVC T4 template
  • The MVC T4 template is now up on CodePlex
  •  

    Friday, May 08, 2009

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

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

    Entity Framework and Entity Data Model (EF/EDM)

    Alex James continues his Entity Framework tips with (in reverse chronological order):

    Simon Segal continues his series on Entity Framework and the Repository pattern with:

    • Danny Simmons offers pointers to EF-related sessions at Tech*Ed 2009 in his Lots of EF Fun at TechEd Next Week post of 5/1/2009. Here’s my list from a session search on “Entity Framework”:

    • BOF17 Build Great Web Applications Today: What Technologies Should I Use? Thu 5/14 | 2:45 PM-4:00 PM | Room 501A Presenter: Todd Anglin
    • BOF21 Solving the Unforeseen Challenges of the ADO.NET Entity Framework: How Can .NET Developers Get Better Prepared? Fri 5/15 | 1:00 PM-2:15 PM | Room 501A Presenter: Jonathan Bruce
    • BOF65 Implementing the Entity Framework in an n-Tier World Thu 5/14 | 8:00 PM-9:00 PM | Room 502A Presenter: David McCarter
    • DAT308 Design Patterns for Application Architecture with the ADO.NET Entity Framework Fri 5/15 | 2:45 PM-4:00 PM | Room 151Presenter: Alex James
    • DAT401 Data Access Hacks and Shortcuts Fri 5/15 | 10:45 AM-12:00 PM | Room 502A Presenter: Stephen Forte
    • DTL05-INT Surprise! It's the Entity Framework Gotchas Thu 5/14 | 1:00 PM-2:15 PM | Blue Thr 1 Presenter: Julia Lerman
    • DTL201 A Strategic Comparison of Data Access Technologies from Microsoft Tue 5/12 | 4:30 PM-5:45 PM | Room 515A Presenter: Michèle Leroux Bustamante
    • DTL20-HOL Application Development with the ADO.NET Entity Framework in the Microsoft .NET Framework 4
    • DTL312 The ADO.NET Entity Framework: Tips and TricksWed 5/13 | 4:30 PM-5:45 PM | Room 152Presenter: Julia Lerman
    • DTL324 Microsoft Visual Studio 2010 Overview for the Business Application Developer Tue 5/12 | 4:30 PM-5:45 PM | Room 515B Presenter: Jay Schmelzer
    • DTL401 Applied Entity Framework Wed 5/13 | 1:00 PM-2:15 PM | Room 408B Presenter: Daniel Simmons
    • PAN65 The Data Access Menu: Making Intelligent Choices Wed 5/13 | 2:00 PM-3:00 PM | 501C Presenter(s): Kent Alstad, Richard Campbell, Stephen Forte, Rockford Lhotka, Paul Sheriff

    Looks to me like EF got the lion’s share of the data-related sessions.

    Beth Massi’s Notifying the UI when Entity References Change in Lookup Comboboxes of 5/1/2009 observes:

    [D]epending on your UI, you may need a notification to fire when the entity reference changes. By default this doesn’t happen with entities generated by the EF designer. Only scalar properties raise change notifications.

    Beth’s shows how to solve the problem.

    Alex James announces in Video on Entity Framework’s Model First in .NET 4.0 post of 5/1/2009:

    Jonathan Carter (aka LostInTangent) has done a Channel 9 video on our upcoming Model First experience.

    Model first was announced a while back here.

    Beth Massi dives into problems with EF’s lack of exposed foreign key values in her Data Binding WPF Lookup Combobox Values to EF Entities post of 4/30/2009.

    Beth Massi’s Tally Rows in a DataSet that Match a Condition post of 4/27/2009 begins:

    Today I got a question that comes up often in data application programming about how to count rows in a DataSet that matched a condition. The DataSet may be bound to a DataGridView or other list control and it’s tempting to start looking at the control to see if you can coax it into returning what you need but usually there is a much better way.

    This post describes the “much better way.”

    Julie Lerman describes her first “baby steps” writing unit tests for EF in her Overcoming "Fear of Unit Testing" Disease article of 4/26/2009 for DevSource.

    LINQ to SQL

    Frans Bouma’s lengthy The desperate quest for doing it 'right' post of 5/4/2009 describes some of the new features coming in the next version of LLBLGen Pro.

    Tech*Ed 2009 lists the following four sessions from a search on “LINQ to SQL:”

    • DAT308 Design Patterns for Application Architecture with the ADO.NET Entity Framework Fri 5/15 | 2:45 PM-4:00 PM | Room 151 Presenter: Alex James
    • DAT401 Data Access Hacks and Shortcuts Fri 5/15 | 10:45 AM-12:00 PM | Room 502APresenter: Stephen Forte
    • DTL402 How LINQ Works: A Deep Dive into the Microsoft Visual Basic and C# Implementations Thu 5/14 | 2:45 PM-4:00 PM | Room 515BPresenter: Jonathan Aneja
    • PAN65 The Data Access Menu: Making Intelligent Choices Wed 5/13 | 2:00 PM-3:00 PM | 501C Presenter(s): Kent Alstad, Richard Campbell, Stephen Forte, Rockford Lhotka, Paul Sheriff

    LINQ to Objects, LINQ to XML, et al.

    Sergey Zwezdin’s jLinq – LINQ for JavaScript post of 5/5/2009 describes jlinq and provides pointers to more information.

    LinqMaster compares Returning a Single Element With LINQ First and LINQ Single in this 4/29/2009 post.

    Tech*Ed 2009 lists the following 10 sessions from a search on “LINQ:” 

    • DTL06-INT Task-Based Parallel Programming with the Microsoft .NET Framework 4 Thu 5/14 | 1:00 PM-2:15 PM | Blue Thr 2 Presenter: Stephen Toub
    • DTL11-HOL Parallel Extensions: Building Multicore Applications with the Microsoft .NET Framework
    • DTL12-HOL Microsoft Visual Basic 9 and LINQ Presenter: David Aiken
    • DTL313 Essential LINQ with C# Wed 5/13 | 2:45 PM-4:00 PM | Room 402 Presenter: Mark Michaelis
    • DTL329 Parallel Computing APIs with the Microsoft .NET Framework 4 Tue 5/12 | 2:45 PM-4:00 PM | Room 150 Presenter: Mark Michaelis
    • DTL336 Future Directions for Visual Basic Wed 5/13 | 8:30 AM-9:45 AM | Room 152 Presenter(s): Jonathan Aneja, Anders Hejlsberg
    • DTL402 How LINQ Works: A Deep Dive into the Microsoft Visual Basic and C# Implementations Thu 5/14 | 2:45 PM-4:00 PM | Room 515B Presenter: Jonathan Aneja
    • OFC307 Integrating WPF and WCF into Your Office Business Applications Wed 5/13 | 2:45 PM-4:00 PM | Room 515BPresenter: Tim Huckaby
    • OFC403 Developing Office Client Solutions Using LINQ and Open XML Thu 5/14 | 4:30 PM-5:45 PM | Theatre (Room 411) Presenter: Eric White
    • PRC09 Mobile Device Development on Windows Mobile Room 409 Presenter: Jim Wilson

    Eric White provides a preview of his Tech*Ed presentation in LINQ / Open XML at TechEd 2009 of 5/4/2009.

    ADO.NET Data Services (Astoria)

    Gil Fink reviews Apress’s new Astoria book by John Shaw and Simon Evans in his Pro ADO.NET Data Services Book Review post of 4/22/2009. He give the book 3.5 out of 5 stars.

    Phani Raju lists his duty hours covering Astoria at Tech*Ed 2009’s Data Development Technical Learning Center booth in his Going to Tech Ed post of 5/7/2009.

    Tech*Ed 2009 lists the following four sessions from a search on “ADO.NET Data Services:”

    • DTL327 Modeling RESTful Data Services Mon 5/11 | 1:00 PM-2:15 PM | Room 404 Presenter: Mike Flasko
    • SOA04-HOL Connecting Microsoft .NET Applications to Legacy IBM Mainframe and Midrange Systems Using Microsoft Host Integration Server 2009
    • SOA302 Building RESTful Services Using WCF Thu 5/14 | 10:15 AM-11:30 AM | Room 404 Presenter: Jon Flanders
    • WUX02-HOL Microsoft ASP.NET Dynamic Data

    ASP.NET Dynamic Data (DD)

    Steve Naughton surfaces again with Communicating Between FieldTemplates in Dynamic Data of 5/8/2009:

    A question that is asked a lot on the Dynamic Data Forum is how can I get a reference to a FieldTemplate, the reason people ask this is because they are used to doing things this was from classic ASP.Net code; the problem with this is that it leads to specialised code in the page, which means custom page and I always go for custom FieldTemplate over custom page.

    Scott Hunter announces Dynamic Data Preview 4 Released in his 5/7/2009 post that describes its relaxed data requirements.

    David Hayden’s ASP.NET Dynamic Data Preview 4 - Still No ASP.NET MVC Love post of 5/7/2009 reviews the new DD release that includes an ADO.NET Data Services sample. His complaint:

    The only question I have is - “Where is the ASP.NET MVC Love?” Surely they still can't be “looking to see where Dynamic Data may fit with ASP.NET MVC” given ASP.NET MVC has been around for over a year in some fashion. Could they? :)

    Tech*Ed 2009 lists the following two sessions from a search on “ASP.NET Dynamic Data:”

    • DTL324 Microsoft Visual Studio 2010 Overview for the Business Application Developer Tue 5/12 | 4:30 PM-5:45 PM | Room 515B Presenter: Jay Schmelzer
    • WUX02-HOL Microsoft ASP.NET Dynamic Data

    SQL Data Services (SDS) and Cloud Computing

    This topic moved on 1/3/2009 to Windows Azure and Cloud Computing Posts for 1/5/2009+.

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

    Not covered at the moment.

    Wednesday, February 18, 2009

    LINQ and Entity Framework Posts for 2/16/2009+

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

    Entity Framework and Entity Data Model (EF/EDM)

    Danny Simmons describes associations between Room and Exit entities in his D3: Modeling Part 1 – Real-World Relationships post of 2/18/2009 for his DPMud multi-user dungeon application that uses an EDM as its data source.

    Julie Lerman’s Logging Entity Framework Queries to Look for Perf Improvement Opportunities post of 2/16/2009 discusses using ObjectQuery.ToTraceString, SQL Profiler, and the eSqlBlast tool on Code Gallery to validate the T-SQL that EF sends to SQL Server.

    She also offers a copy of The Acknowledgements from her book.

    Doug Purdy’s “M”ix09 (Using “M” to write REST services and clients) post of 2/11/2009 includes the following diagram of “Oslo” Development Domains, which includes the Entity Editor and MEntity textual DSL (empahsis added):

    See the entry for Doug’s post in the ADO.NET Data Services (Astoria) section for more details about the MIX09 session named DEVELOPING RESTFUL SERVICES AND CLIENTS WITH “M”.

    LINQ to SQL

    David Hayden’s updated LINQ To SQL and Executing ADO.NET Commands - O/R Mappers post of 2/16/2009 compares using LINQ to SQL with SqlClient.SqlConnection and .ExecuteNonClient for parameterized INSERT operations and concludes: “Using LINQ To SQL is much simpler by far.”

    LINQ to Objects, LINQ to XML, et al.

    Rhys Parry’s LINQ and Deferred Execution post of 2/17/2009 is yet another exposé of issues with LINQ well-known deferred execution feature. Rhys’s earlier LINQ-related posts are LINQ and Extension methods (2/15/2009) and Getting Started with LINQ (2/13/2009).

    Eric White explores The Composability Thought Process for LINQ on 2/17/2009 with a pointer to his earlier Finding Paragraphs by Style Name or Content in an Open XML Word Processing Document post that incrementally develops the subject query.

    Dmitry Robsman’s Channel 9 Interview: ASP.NET MVC using Visual Basic XML Literals shows how he implemented ASP.NET MVC views using Visual Basic's XML Literals instead of .aspx pages. (2/16/2009, Thanks to Beth Massi.)

    ADO.NET Data Services (Astoria)

    Doug Purdy’s “M”ix09 (Using “M” to write REST services and clients) post of 2/11/2009 announces that the “Oslo” team will use MIX09 to:

    [U]nveil how “Oslo”/”M”  can be used to build RESTful client and services using domain specific models and languages.  

    The net result is that RESTful clients and services are much easier to write, understand, maintain, etc.

    Doug describes what appears to be a session named DEVELOPING RESTFUL SERVICES AND CLIENTS WITH “M”:

    Learn how Web developers can use “M”, a new language for describing data, metadata and domain specific languages to enhance RESTful services like HTTP, JSON, RSS/Atom, and more.  Also see how “M” can be used on premise or in the cloud to achieve greater development productivity and to create more compelling customer experiences. [Emphasis added.]

    I’m surprised that Doug didn’t mention Astoria in his post.

    ASP.NET Dynamic Data (DD)

     

    SQL Data Services (SDS) and Cloud Computing

    This topic moved on 1/3/2009 to Windows Azure and Cloud Computing Posts for 1/5/2009+.

    SQL Server Compact (SSCE) 3.5 and Sync Services

    This topic was dropped as of 1/3/2009.

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

    Shawn Wildermuth announces that Prism Now Supports Silverlight 2! on 2/18/2009. Prism is a codename for new WPF guidance for the patterns&practices group’s Composite Application Block.

    Steve Martin’s Higher Standards for Web Standards post of 2/16/2009 discusses Microsoft’s reluctance to join the IBM-sponsored Web Services Test Forum. Steve writes:]

    In many cases, the right answer isn’t necessarily to define something new, but to instead carefully consider whether technology or initiatives already exist to solve the problem. In the end, we should judge the strength of standards on industry and customer adoption alone. As an example, IBM recently announced a consortium called “WSTF”:  Web Services Test Forum which leaves us a tad puzzled.

    As of today, the WS-* standards are largely complete within W3C, OASIS, WS-I, DMTF, etc. and are widely implemented in infrastructure products and used by organizations all over the world. We were thrilled to participate in the Oasis announcement just last week on WS-RX, WS-TX and WS-SX. With regard to testing, we think it is critical that customers be able to propose scenarios that match their real-world interoperability needs. Equally important - both successes and failures must be made public. This is why we’re still evaluating our participation in WSTF.

    Steve mentions the Web Services Interoperability (WS-I) organization, which has been very quiet lately, but mentions:

    Greg Leake runs one of the largest interoperability labs in the world and publishes results and guidance on WS* / WebSpehere / .NET interop. Stay tuned for more here – Greg is just completing his work on WebSphere 7.

    Wednesday, February 04, 2009

    LINQ and Entity Framework Posts for 1/26/2009+

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

    • Updated 1/28/2009 5:00 PM PST: Additions
    • Updated 2/4/2009 5:00 PM PST: Substantial additions

    Entity Framework and Entity Data Model (EF/EDM)

    Julie Lerman alerts readers on 2/2/2009: Dear Rough Cuts Readers: Safari PDF for Programming Entity Framework is still the Rough Cuts version (as of Feb 2).

    •• Diego Vega’s EntityDataSource and Bind: What are those square brackets? post of 2/2/2009 explains that:

    [T]he design time component of ASP.NET will catch property names that contain dots, and it will try to escape them by surrounding them with square brackets (leading to a Bind expression of the form “[Categories.CategoryID]”).

    Unfortunately, the rest of the ASP.NET components which need to evaluate the binding expression are actually not capable of parsing the square brackets escaping notation (i.e. for DataBinder.Eval() the brackets actually indicate that a lookup in an indexed property is necessary, and there is no indexed property in this case).

    The workaround is to delete the square brackets.

    My Free Huagati DBML/EDMX Professional Tools License for 10 Purchasers of my LINQ and Entity Framework Book post of 1/29/2009 explains how purchasers of my new book can get a free Huagati DBML/EDMX Tools (Professional edition) license.

    •• Matthieu Mezil’s EDM can save your hair :-) post of 1/29/2009 explains how to deal in the EDM Designer and CSDL file with a database that has the following characteristics:

    • an asbtract entity type Base (mapped on Bases)
    • an entity type Entity which inherits Base and which is mapped on Inheriteds
    • an entity Description
    • an 1 -> * association between Base and Description

    Muhammad Mosa (a.k.a. Moses of Egypt)’s First Steps toward Test Driven Design\Development post of 1/28/2009 describes his efforts to apply TDD with EF and promises to “show how to follow TDD while working with Entity Framework and being independent of it” while implementing the guidelines quoted in this post, which “where like magic words to me. Keep tuned.”

    Stefan Cruysberghs’ Sharing source code between .NET and Silverlight post of 1/27/2009 observes:

    A common problem when developing Silverlight applications is how to share classes and especially (Entity Framework) entities which are compiled for the full .NET framework in a Silverlight application. Silverlight is a browser plugin and a subset of the full .NET framework. Therefore Visual Studio does not allow referencing .NET assemblies from your Silverlight application.

    Fortunately there is a very simple technique to share source code. In this article I will try to demonstrate this technique with several real world examples and I will give you some handy tips.

    My “Professional ADO.NET 3.5 with LINQ and the Entity Framework” Is in Stock at Amazon post of 1/23/2009 alerts LINQ and EF aficianados to the availability of my latest book. (Repeated from last week’s post.)

    Julie Lerman announces in Entity Framework at Philly.NET followed by a Hands on Lab Tomorrow night (1/27) that Bill Wolff (the user group leader) and Rob Keiser are leading a Entity Framework hands-on-lab on 1/27/2009 from 6:00 - 8:30 PM at Fort Washington, PA. More details are available on Philly.NET's home page.

    David Sceppa’s Entity Framework-Enabled Providers Lists post of 1/26/2009 lists released providers here and released and all publicly available providers, including pre-release (beta) providers here.

    LINQ to SQL

    Andrei Rinea reports and works around a LINQ to SQL NullReferenceException gotcha on 1/30/2009. (The comments are in Romanian.)

    Joel Cunningham’s Regenerate Linq to Sql Classes post of 1/28/2008 shows how to “call a replace.vbs script after creating the dbml file” … “to change the DataContext from being public to internal which is not possible to do using sqlmetal.”

    LinqMaster describes How to Use Compiled Queries in Linq to Sql for High Demand ASP.NET Websites in his 1/28/2009 post.

    Stan Naspinski’s open-source Slick-Ticket Trouble Ticketing/Help Desk System uses LINQ to SQL rather than Entity Framework for the reasons Stan outlines in his Why I decided to stick with Linq-to-SQL over Linq-to-Entities post of 1/17/2009. You can download the Slick-Ticket C# project from CodePlex; it’s licensed under the GNU General Public License version 2 (GPLv2). Here’s the new ticket screen (click for full-size image):

    LINQ to Objects, LINQ to XML, et al.

    • Barry Dahlberg’s LINQ to NHibernate, IEnumerable<T> vs IQueryable<T> post of 2/1/2009 explains that NHibernate’s session.Linq<Foo>().WithId(123).Single() returns an IQueryable<Foo> which doesn’t touch the database. Barry shows an extension method that returns the desired <Foo> instance.

    •• Maarten Balliauw’s PHPLinq 0.4.0 released on CodePlex! describes PHPLinq (a.k.a. LINQ to PHP) and the new features in version 0.4. About PHPLinq, he writes:

    PHPLinq is a class library for PHP, based on the idea of Microsoft’s LINQ technology. LINQ is short for language integrated query, a component in the .NET framework which enables you to perform queries on a variety of data sources like arrays, XML, SQL server, ... These queries are defined using a syntax which is very similar to SQL.

    Using PHPLinq, the same functionality is created in PHP. Since regular LINQ applies to enumerators, SQL, datasets, XML, ..., I decided PHPLinq should provide the same infrastructure.

    Eric White describes an approach and presents code for normalizing LINQ to XML trees in his Equality Semantics of LINQ to XML Trees post of 1/27/2008. Eric writes:

    In certain scenarios, it is important to be able to compare two XML trees for equivalence. For example, if you are writing a web service that serves results of queries, and you want to cache query results so that duplicate queries use previously cached results instead of always accessing the underlying database. However, the senders of those queries may potentially be using a variety of tools to generate the queries, and these tools may introduce trivial differences into the XML. The intent of the queries may be identical, but XNode.DeepEquals returns false if you compare the XML that contains semantically equivalent, but trivially different queries.

    Mike Taulty takes on Anonymous Methods, Lambdas, Confusion in this 1/28/2009 post. Mike writes:

    Not surprisingly, not everyone out there is on .NET Framework V3.5 Service Pack 1 and not everyone is yet writing LINQ queries and using Lambdas and so on and so there’s still a need to try and catch up with some of what’s been going on.

    This is going to be particularly true in the VB world where some of the language features are not present until Visual Studio 2010 ships.

    I thought I’d try and write a “potted history” of what’s been going on in with all these lambdas and anonymous methods and so on to see if that’s of any help.

    Dan Whalin’s Free Webinar – Increase Productivity with .NET and LINQ post of 1/25/2009 announces that Dan will present a 00:50:00 Webinar about LINQ to Objects, LINQ to XML, LINQ to SQL, and LINQ to Entities on February 5, 2009 at 1:00 P.M. EST (10:00 AM PST). According to the abstract:

    Interested in increasing developer productivity?  This webinar from ROI Training and The Wahlin Group will introduce .NET developers to Microsoft’s Language Integrated Query (LINQ) technology and show how it can be used to minimize code and application maintenance costs.  The webinar is presented by Dan Wahlin who will introduce several LINQ technologies including LINQ to Objects, LINQ to XML, LINQ to SQL and LINQ to Entities.  Learn to query object collections and XML and see how data from a database can be automatically mapped to custom data entity objects with minimal coding.

    ADO.NET Data Services (Astoria)

    Sebastien Lambla’s How to Fix Microsoft’s Two-Tier Service Application Scenario (REST) post of 1/25/2009 takes Microsoft’s patterns & practices group to task for their Two-Tier Service Application Scenario (REST) post to CodePlex’s patterns & practices: App Arch Guide 2.0 Knowledge Base. Seb’s introduction states:

    I’ve had many rants about Microsoft’s attitude towards REST and the marketing branding they put on (some teams being much worse than others by arrogantly or unknowingly putting the word REST on the name of their framework).

    This entry is no such rant, but an effort to outreach to the authors. The document has issues, but it is my belief that with the right corrections, it could be made accurate.

    ASP.NET Dynamic Data (DD)

    Steve Naughton continues his DD rampage with Making Individual Tables Read Only – Dynamic Data of 1/28/2009.

    Steve Naughton’s Disallow Navigation on ForeignKey FieldTemplate – Dynamic Data post of 1/26/2009 is based on his response to the A few problems with my dynamic data website thread in the ASP.NET Dynamic Data forum.

    SQL Data Services (SDS) and Cloud Computing

    This topic moved on 1/3/2009 to Windows Azure and Cloud Computing Posts.

    SQL Server Compact (SSCE) 3.5 and Sync Services

    Liam Cavanaugh’s What's New with Sync Framework post of 1/26/2009 describes “what [has been] going on … in the Sync Framework team since last November.” Topics include:

    • Sync Framework v2
    • Sync Services for ADO.NET v2
    • Project “Huron”
    • SyncToy 2.0

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

    •• John Papa’s Silverlight, Syndicated Feeds, and Isolated Storage post of 2/1/2009 describes his “Data Points” column entitled “Syndicated Data And Isolated Storage In Silverlight” for the February 2009 issue of MSDN Magazine. The article addresses:

    •• J Sawyer, a Microsoft Developer Evangelist in Houston, TX, describes Url Routing in ASP.NET in this 1/30/2009 post.

    •• Shawn Wildermuth reports that the New Oslo CTP is Live! but doesn’t include the Quadrant tool. Shawn promises more posts about the new CTP shortly.

    •• Mike Amundsen raises issue of developers ignoring the full set of HTTP methods in his ASP.NET MVC: so POST == DELETE, eh? post of 1/30/2009. Mike says “no” to use of POST for RESTful PUT and DELETE operations.

    Shawn Wildermuth’s Building AgiliTrain: Part 1 - Why ASP.NET MVC post of 1/28/2009 explains:

    I've spent the better part of six weeks building the new AgiliTrain website and its been quite a lot of fun. Of course if you have been reading this blog for long you know that I usually take a personal project like this as an opportunity to learning something new.  In this case I did three things I haven't done on a personal project before:

    • Use ASP.NET MVC (Beta)
    • Use Oslo's MSchema
    • Use a Designer

    I've been thinking a lot about how I would characterize my experience with ASP.NET MVC. I recently was at a talk from Paul Lockwood (at the Atlanta .NET User Group) and he thought that it was two weeks of a steep learning curve then bliss.  That's pretty close to my experience.  I thrashed for a couple of weeks wondering whether going back to WebForms would be faster...but I was patient.

    •• Guy Burstein reports the availability of ASP.NET MVC 1.0 RC source code in his Just Released: Source Code for ASP.Net MVC 1.0 RC post of 1/28/2009.

    Ben Hall test drives the ASP.NET MVC 1.0 RC on 1/27/2009 and writes ASP.net MVC RC1 - ViewData.Model becomes Model and ASP.net MVC RC1 – Removing Code Behind files.

    Stefan Cruysberghs’ Sharing source code between .NET and Silverlight post of 1/27/2009 observes:

    A common problem when developing Silverlight applications is how to share classes and especially (Entity Framework) entities which are compiled for the full .NET framework in a Silverlight application. Silverlight is a browser plugin and a subset of the full .NET framework. Therefore Visual Studio does not allow referencing .NET assemblies from your Silverlight application.

    Fortunately there is a very simple technique to share source code. In this article I will try to demonstrate this technique with several real world examples and I will give you some handy tips.

    [Copied from the Entity Framework and Entity Data Model (EF/EDM) section]

    Scott Guthrie’s ASP.NET MVC 1.0 Release Candidate Now Available post of 1/27/2009 announces the availability of ASP.NET MVC 1.0 RC1 and describes its new and/or improved features:

    • Visual Studio Tooling Improvements
      • Add Controller Command
      • Add View Command
      • Adding and Customizing Scaffold Templates
      • Go To Controller / Go To View
      • MSBuild Task for Compiling Views
      • View Refactoring Support
    • View Improvements
      • Views without Code-Behind Files
      • Model Property
      • Setting the Title
      • Strongly Typed HTML/AJAX Helpers
    • Form Post Improvements
      • ModelBinder API Improvements
      • IDataErrorInfo Support
    • Unit Testing Improvements
      • ControllerContext changed to no longer derive from RequestContext
      • AccountsController Unit Tests
    • Cross Site Request Forgery (CSRF) Protection
    • File Handling Improvements
      • File Uploading Support
    • AJAX Improvements
    • jQuery Intellisense Files included within ASP.NET MVC Project Template
      • Request.IsAjaxRequest Property
      • JavaScriptResult ActionResult and JavaScript() helper method