Tech Ed 2009 - Thursday - Neil Bostrom

Building Line-of-Business Applications Fast with Microsoft Silverlight and Microsoft .NET RIA Services

RIA services provides a pattern to write application logic that runs on the mid-tier that is projected on the client side. Making producing 3 tier application simpler. It's not just restricted to Silverlight.

Tim started off by showing the new Silverlight Business application template that comes with Visual Studio 2010 out of the box. This template seems pretty complete with loads of functionality like forms transitions, login, register, navigation, resources and styling. Very sexy, well worth looking through this template.

Domain service class is the guts of RIA services. When adding that class it prompts to point at your model. It then generates an API using your model, insert, update, delete, etc, methods for all your entities.

RIA services does its querying with two methods, one is the model collection name (Employees), you would bind to that. After that you would populate that collection using the Load method on the context.

RIA services also includes some out of the box helper controls. One of them being the data pager control. As this control works on IQueryable in your model, it does true server side paging.

RIA services takes advantage of the Data annotation syntax, similar to AJAX and MVC. This is a general direction in Microsoft which is great. We can implement this once in our common code and get validation for free on almost any client type.

RequestAuthenication and RequiresRoles is a nice way to control method calls using forms authentication on your server side.

 

Successfully Administering and Running Microsoft Visual Studio Team System Team Foundation Server 2008/2010

Turns out the install success rate for TFS 2008 was quite low. Looks like we were lucky on that front. You can never rename a team project, that's why Microsoft uses codenames for projects!

TFS performance comes from hard disk speed. Disk read / writes in SQL is where the real hit in TFS is. Try to split the databases out.

It's recommended that you only use a single team project for your company. Use iterations and areas to break down projects. Microsoft has a single team project for "Office" and all the projects (Word, Excel etc) are all in that project. The main reasons behind this is Work items can't be moved between team projects, the out of box reports work on a single team project.

Microsoft suggests to run TFS in a virtual environment. Benefits come from snapshot and disaster recovery.

When splitting the tiers up, it is suggested to have sql and SSRS and web tier on the other.

Read the online notes, LOADS AND LOADS of tips on performance. Legend!

TFS 2010 installation has been massively simplified. Project collections now allow moving of everything to different to servers. All the new features in TFS 2010 are only available in VS 2010.

 

Enhancing the design-time experience for Microsoft Silverlight 3

This session is talking about creating controls that are blend friendly. That appear in Blend and are easy to design. When creating controls that would call data or webservices, check if in design time and return sample data in place of live data.

Overide ArrangeOverride and MeasureOverride to run code on resize or move in design time. Use Dependecy Properties to make control properties available in Blend. Standard meta attribute like Description, Category, DisplayName, PropertyOrder, NumberRange, NumberIncrement, NumberFormat, EditorBrowsable will get used by Blend to breakdown the placement of the property.

With all this extra design time code, you can get a large code base. It is suggested you break out the design time code into a new dll. If you name that DLL *.Design.dll, VS and Blend will go looking for it and use them on the fly. If you name it *.Expression.Design.dll only blend will use it. If you name it *.VisualStudio.Design.dll, visual studio will automatically pick it up. In this new dll, add reference to Microsoft.Windows.Design to get access to the extension support.

Next topic was Behaviours. Blend has a bunch of behaviours out of the box and there is an option in blend to pull down more. Behaviours is a very easy way to wrap up a small set of functionality you would want to apply to any control.

To build your own behaviour, inherit from Behaviour in System.Windows.Interactivity. If you want to limit it to a type, then pop that in the generic type. AssicatedObject stores what object the behaviour is being attached to.

 

Debugging Microsoft ASP.NET and Other Microsoft .NET Production Issues with WinDbg and Microsoft Visual Studio .NET 2010

This session is a favourite of mine, been to it for a few years and has always been very informative. This year it has been updated to take advantage of the VS 2010 feature that allows easy opening and diagnosing memory dump files. In Visual Studio 2010 the Parallel Stacks window shows a diagram of where every thread is and its stack in a lovely chart, giving you loads of insight into what's going on with your website.

As always Tess got down and dirty with some WinDb.exe action. WinDb.exe is a low level debugging tool that is not aware of .NET. So to give it some knowledge of .NET you need to first load sos.dll. You do this by running the following command:

.loadby sos mscorwks

Once you have done this you can walk through some of the CLR using an array of commands. Some of the interesting things you can do is say:

!dumpheap -stat

This will list all of the objects on the heap. From here you can drill into the objects for more information by using

!do (memoryaddress)

Once you find something that you believe should have been GC'ed, you can run the following command:

!gcroot (memoryaddress)

To give you a tree of what the GC is holding on to! This is so immense!

If you forget what the commands are, you can easily load up a command file that gives a handy context menu on the right using:

.cmdtree c:debuggerscmdtree.txt

You can get the cmdtree.txt from Tess's website.

Debug Diag Tool can capture memory dumps on the fly or look for requests holding. Its produced by the IIS team and can be easily downloaded and installed.

Tinyget is another handy little tool to stress test websites. Means you can prep your website before taking a memory dump.

 

All You Needed to Know about Microsoft SQL Server 2008 Failover Clustering

I know nothing about failover clustering so this was going to be a sure win! Interestingly clustering only helps with machine fail over, not database failure.When a node does fail over, any application will fail to connect while the next node comes online. So you need to put retry code in to keep your application running.

SQL server 2008 clustering works better with Windows Server 2008 R2 clustering. So the first thing you would do is setup Windows Server Clustering. Once you have done that you can then install the SQL Server clustering installation on your primary machine. You would then add all the other machines using the Add Node option in the setup wizard.

Sexy feature of clustering is that you can rollout patches and service packs without any downtime by applying the patches to each node, one at a time. This gives you good uptime as there is no need to take your application offline. You can even do full version upgrades, so moving from SQL 2005 to SQL 2008 with only a min or two's worth of downtime which is just the database script upgrading to SQL 2008.