Neil Bostrom: Tech Ed 2008 - Day 3

Creating Custom LINQ Providers - LINQ to Anything

This session sounded awesome on the write up and it did not disappoint. Bart De Smet blasted through the inner workings of LINQ and expression trees. Covering how LINQ is really just a compiler trick to call extension methods and a break down on how expression trees are built up when using LINQ. The major part of the session was on parsing the expression tree once it had been given to a provider. This gave invaluable knowledge on the inner workings of expression trees and best uses with them. A nice trick he showed was using Expression.Compile then DynamicInvoke to run the expression and get a result for it. Another cute trick he mentioned was to apply multiple different provider attributes to a single class. Applying LINQ to SQL and sharepoint attributes allowed him to pull out database records into objects then save them directly to sharepoint, without any intervention.

.Net Services Drilldown

Azure Service Platform and buses were the buzz words for this session. Microsoft are releasing a service bus to allow service publishing and user access control. A service bus is just a means for hooking up clients and services. So if you had a service that you want to offer clients, you can publish it on the bus and the clients would have a uniformed way to access your service, wherever that may be. Microsoft's release for that gives everyone an address at It's currently in CTP but you can go to and register for an account to play with it. To support connecting to the bus they have released SDKs for all the services in the cloud. These SDKs are for .NET, Java and Ruby currently.

Entity Framework

This being the only other Entity Framework session it was a must. It was presented by the same lady as the last one, which is a shame as the demos and description just weren’t up to scratch. It was a slow start to the session but it picked up by the end. A few gems did come out of the session on performance. Using CompiledQuery.Compile to cache expressions will reduce cpu usage for any page that is querying the database as expression trees are expensive to create. Switching off tracking is also another tip to increase performance on read only pages. A little gem did come up during one of the demos that showed that you can call an Include method on child relationships to make them be included on webservice calls on your entity objects. The session did go a little sideways by the end of it by showing ADO.NET Data Services. This is a feature I’ve been looking to get information on so that was really helpful. We have been looking for a good way to use LINQ to query the database from Silverlight. However Silverlight runs on the client so it can only call webservices. With the ADO.NET Data services it runs via a webservice but gives you a fully LINQ supported model to query your database.


My favourite speaker, Roy Osherove gave a session on the performance problems you can get with Reflection. The example he gave was that you want to Clone a bunch of objects. The usual way you would do that would be to use reflection to copy each property to the new object. He gave stats on three ways, standard reflection, DynamicMethod and String Compile. The standard reflection way was always the slowest. The last two however were quicker in different situations. The DynamicMethod started out much quicker than the compiled strings, however, once we passed 200,000 clones it was taken over by the compiled strings. The reason for this is that the DynamicMethod under the hood has a delegate point to the real method that means it has to look it up to execute it. As always Roy finished with a home grown song which is always amusing!

Developing and Deploying your first cloud service

This has been my first real talk about the Microsoft Windows Azure Platform. The Azure platform is a "cloud" offering which means its a managed service that could be running on one box or a thousand. It is all about distributed computing, your code will run somewhere on the cloud but you have no idea where. This model gives the greatest scaleability, as you can just ramp up the number of "boxes" you are running your code on. The demo showed how to access the file store and deploy a simple web application into the cloud. The cloud platform is a very locked down enviroments so there is no file system as we know it. It instead has a virtual file system model using Tables, Blobs and Queues. These three items are part of the Azure Storage Service. The cloud offering is an exciting opportunity to write truely scaleable applications. When we say scaleable, we mean just change the config from "x" nodes to "y" nodes and you could just double your application capacity. Its a great version 1 offering from Microsoft and I'm excited about getting the opporunity to work with it.