03
Jan

ALT.NET Seattle

One of the cool things about living in Seattle is the sheer number of passionate developers around. Whether you're dropping into offices, heading across campus for lunch, meeting downtown for music and beer or in my case last month taking a Saturday out to participate in ALT.NET Seattle, there are ideas, enthusiasm and discussions with great developers to be had everywhere.

The ALT.NET event was particularly interesting. If you didn't already know the name encapsulates:

  • the desire to improve the art, process, individual and product
  • the understanding that the right tool for the job doesn't always ship with the .NET

The event follows the same minimal up-front planning modern development practices enjoy relying on talented people and simple structure to achieving something great in a short space of time.1

This open-spaces format involves a small deck of cards to write topics you'd like to talk about on and a board with rooms and times to drop them into. I was surprised at how well the event unfolded (bar one session that veered off-course) given our unplanned attempts at the Guernsey developer group always resulted in five people having dinner in a bar :)

I had an enjoyable day and my thanks go to Brad Wilson (ASP.NET) for driving and listening to my nostalgic 8-bit discussion with fellow brit Ade Miller (p&p) who previously worked at Future Publishing (Your Sinclair magazine). I'm now messing around with a .NET based Spectrum emulator I started years ago and I'm going to blame him for that.

The best news is that there are more events planned for the coming months:

  • January 17th normal format, location TBA
  • February - provisionally the 7th, regular format, location TBA

ALT.NET Seattle 2009 Conference

This is the big one immediately preceding the MVP Summit by running February 27th to March 1st at Digipen in Redmond. Glenn Block has more details.

Registration will open on Tuesday, 6pm (GMT-8), attendance is free and spaces are limited so get in quick!

Consider joining the Seattle area ALT.NET group or ALT.NET Facebook group for more details or to get involved.

[)amien
1And as either Glen or Brad said with a nod to the end-of-credits bit in Ferris Bueller - "When it's over it's over. Go home already."

08
Dec

ASP.NET MVC open-source content management system

The nice bunch of people over at Mix Online have released an open-source content management system called Oxite that is built on top of ASP.NET MVC!

As well as providing the usual blog facilities it also boasts standards compliance, extensibility and a test suite. Nice!

Oxite joins the group of .NET blogging platforms including:

[)amien

07
Dec

LINQ to SQL templates updated

Just a quick post to let people know that I've been continually updating my LINQ to SQL templates for Visual Studio's built-in templating language (T4) since they were published in September.

These templates let you customize the code generated from the DBML file by providing drop-in replacements for SQL Metal/designer (bar some namespace differences, for now).

Both C# and VB.NET language output is supported. To get started just download, drop the .ttinclude and .tt file for your language into your project, rename the .tt file to match your .dbml file and then set the existing .designer file's build action to none and you're set!

To see them in action check out this 27 second mini-screencast of the next version.

[)amien

31
Oct

LINQ to SQL next steps

There has been a flurry of posts and comments in the last 24 hours over the future of LINQ to SQL so I thought it would be interesting to provide some information on what the LINQ to SQL team have been up to and what we’re working on for .NET Framework 4.0.

A little background

LINQ was a new feature in .NET 3.5 that provides a store-agnostic query language syntax using a provider model.

As part of that initiative the C# team delivered LINQ to SQL – a LINQ provider to SQL Server with additional update and access management via DataContext and mapping tools such as the designer and SQL Metal. The result is a great lightweight solution that is easy to get started with and a good data access solution where your database and objects are closely aligned.

Meanwhile Data Programmability worked on an initiative to provide abstraction between conceptual and physical models of databases to allow applications to operate independently of the database vendor and underlying physical schema. LINQ support was also added in the form of LINQ to Entities and it shipped with it’s management tools in .NET 3.5 SP1.

Which now means we have two object-relational mapping options that overlap in some areas but with very different backgrounds.

The story so far

Some time before I started in May LINQ to SQL was handed over to Data Programmability.

One of the first things you notice is that the overlap between the two object-relational mapping solutions Microsoft causes confusion and hesitation.

Do I want something lightweight and easy or do I need the extra abstraction with a richer feature set?
If I want to start with LINQ to SQL today but know that the database won’t stay under my control how would I move to Entity Framework?

These are the questions that many developers face and our team spent a lot of time looking at the differences between the two stacks, how they behave and which features were missing if you wanted to migrate from LINQ to SQL to Entity Framework v1. We put together code samples, some helpers and documentation which are now being serialized on the ADO.NET blog and left us with a better understanding of the disparity – some of which the EF team have already addressed in v2.

Where next

The decision has been made that Entity Framework is the recommended solution for LINQ to relational scenarios but we are committed to looking after our users and are approaching this in two ways.

Firstly we are going to make sure LINQ to SQL continues to operate as it should. This doesn’t just mean making sure what we had works in .NET 4.0 but also fixing a number of issues that have arisen as people pick it up for more advanced projects and put it into production environments.

Secondly we will evolve LINQ to Entities to encompass the features and ease of use that people have come to expect from LINQ to SQL. In .NET 4.0 this already includes additional LINQ operators and better persistence-ignorance.

This isn’t to say LINQ to SQL won’t ever get new features. The communities around LINQ to SQL are a continuous source of ideas and we need to consider how they fit the minimalistic lightweight approach LINQ to SQL is already valued for. Where these suggestions fit with this strategy we will be working hard to get them into the product. Some enhancements like the T4 templates can be released independently but runtime elements need to stick to the .NET Framework schedule.

In conclusion

DON’T PANIC
(in large, friendly letters)

LINQ to SQL will continue to work and EF will better address the needs of LINQ to SQL users with each new release.

[)amien

14
Oct

Disappointing new MacBook Pros

Like many other MacBook Pro owners I've been waiting for the October 14th event with some excitement. The highlights include:

  • Stronger aluminium block casing
  • NVidia dual graphics for low-power or high-performance
  • Glass multi-touch/multi-press trackpad

But the downsides are also worth noting, all of which make me think when I replace my 2.6GHz 17" MBP in a year Apple aren't going to have something I want to replace it with.

  • No 17" model
  • 4GB RAM limit
  • Glossy screen only
  • 1440x900 resolution
  • Firewire gone

Keith Combs has some similar observations in more depth while AppleInsider is suggesting a January refresh for the 17"

[)amien

27
Sep

Friday Fill-Ins #91

Started by Janet, picked up via Brad.

  1. Settling down in the Redmond area and being with my team are some of the things I'm most looking forward to in October.
  2. Sometimes I am so deep in thought when people ask me a question I look dazed and confused, failing to answer them.
  3. People grow and situations change and that's why there is a saying, "never say never"!
  4. When I'm down, I take a nap, wake up and do something different or creative.
  5. Microsoft Building 35 is where you'll find me most often.
  6. A rainy day is good for splashing in puddles, getting wet and drying off near something warm with cocoa.
  7. And as for the weekend, tonight I’m looking forward to wrapping things up, tomorrow my plans include going out with my Vancouver friends one last time and Sunday, I want to go parkouring and start packing!
[)amien
14
Sep

LINQ to SQL template for Visual Studio 2008

The latest update to my template for generating LINQ to SQL classes from DBML is now available.

If you want to customize the LINQ to SQL code generation phase in your project without additional tool dependencies this could be what you’re looking for.

11 Dec 2008 Fixes to association code with one-to-one's and with no serialization required.
7 Dec 2008 Added IsDelayLoaded, IsUnique. Fixed association code, stored proc update overrides.
17 Nov 2008 Added IsInheritanceDefault read/emit IsDefault on type
26 Oct 2008 Emit column Name attribute if it doesn't match the member (thanks Steele)
20 Oct 2008 Handle class naming better, fix associations for renamed or out-of-sequence keys and their access modifiers
25 Sep 2008 Figure out missing association keys by using either sides primary key
25 Sep 2008 Empty DBML namespace is now no namespace instead of "MyApplication"
23 Sep 2008 fixed stored procedures with 0 parameters
22 Sep 2008 fixed VB.NET IsForeignKey attribute for associations
18 Sep 2008 now generates stored procedures including insert/update/delete with concurrency checking.

New since 'reloaded' version

  • Inheritance - generates subclasses with all properties and code mappings.
  • VB.NET - CSharpDataContext.tt is joined by a VB.NET emitting VBNetDataContext.tt.
  • DataContract SP1 – additional mode to emit SP1-compatible DataContract serialization via Roger Jennings.
  • Composite keys – both as the primary key and as a foreign key in an association.
  • Type attributes – the data context and entity types can now be sealed or abstract as well as public, private, protected, internal or protected internal.
  • Associations – prevents foreign key values changing once the object association is made and updates parent side of one-to-many associations.
  • Stored procedures – generates method wrappers and associated methods to facilitate insert/update/delete with concurrency support.

Functionality compared to designer

A primary goal in developing the template was to allow for easy switching between the template and the LINQ to SQL designer so things are very similar.

Missing

  • Comprehensive sanity checking on the DBML.
  • The Custom Tool Namespace and project namespaces are not pulled in when the DBML namespaces not specified.

Fixed

The designer has a few bugs which helpfully this template doesn’t suffer from.

  • Modifying a table via a stored procedure using original values for concurrency will throw ChangeConflictException and not silently fail.
  • Protected internal virtual property doesn’t forget to be virtual.
  • Checks all associations based on a foreign key are not loaded before allowing change and not just the first one.

Improved

  • Fully customizable with full source.
  • Serialization mode to support DataContract improvements in .NET 3.5 SP1
    To use uncomment the line // data.Serialization = SerializationMode.DataContractSP1; in xDataClasses.tt
  • CanBeNull attribute generated for value types (useful when working with metadata).

Source compared to designer

The designer generated code can be difficult to read and isn’t well suited to template generation so the output from this template is different in a number of ways:

Sequence

Everything related to a column mapping – the storage variable, event signatures, attribute and the property itself – is batched together so it can be hit with a single loop making the template shorter and easier to work with.

#regions

Opinion may be divided on the usefulness of #regions in your own code but for code generation of large files I found it invaluable. There are regions for the logical parts of the data context and within each entity such as construction, column mapping, associations and serialization.

Style

The code generated should be a little easier to follow – if/else ordering, no redundant casts or extra brackets etc.

Namespace

I don’t believe adding “this” everywhere or fully qualifying attributes and exceptions makes things easy to read. I realize this might cause some name conflicts for some people but it is easy to change yourself and means the code is shorter and easier to work with for the majority.

Getting started

Although I work on the LINQ to SQL team this template should be treated as a third-party sample and is not supported by Microsoft.

Download LINQ to SQL for T4 v0.79 (13 KB)

  1. Add the L2ST4.ttinclude and either CSharpDataContext.tt or VBNetDataContext.tt to your project depending on your language type
  2. Rename the xDataContext.tt to match your DBML file but with .tt extension instead of .dbml
  3. Set the existing DBML file's .designer.cs/vb Build Action property to None to ignore the LINQ to SQL built-in code generation

Note that the template will only regenerate when it has been changed so use Run Custom Tool from the template's right-mouse button menu in Solution Explorer when you’ve changed the DBML.

Should you wish to switch back to using the designer code then set the DBML file's .designer.cs/vb Build Action to Compile and either remove the .tt and .ttinclude file for permanent removal or just set the .generated.cs/vb Build Action to None to keep it around. VB.NET users will need to use Show All Files to see the .designer.vb file.

Customization

The template runtime built into Visual Studio 2008 is called T4 and requires no additional tools however if you do a lot of editing you might want to install the Clarius T4 Editor for syntax highlighting and also check out the treasure trove of T4 material that is Oleg Sych’s blog.

The template is simple to follow, it loads the DBML file as an XML document then uses LINQ to XML to instantiate wrapper objects over the elements. This gives you a simple way to change default naming and behavior while making the template simpler to work with.

Let me know how you get on by leaving a comment here.

[)amien

26
Aug

DHL failure in usability

A couple of weeks ago I ordered the latest third-generation of the DAS Keyboard – my second generation packed away back in Guernsey and the Alps-switched one from DSI incapable of reliably registering more than 2 keys on USB.

Being that I’m fixed on the European keyboard layout (our enter key is double height with the backslash moved down next to Z) I had to order from Germany, specifically the guys over at getDigital.de

When the keyboard hadn’t arrived a couple of weeks later I headed off to the tracking link at DHL Germany.

As a customer all I’m interested in is:

  • Where is the package now?
  • When will I have it?

A good developer would understand and deliver this. Instead DHL present:

Piece-number 9507xxxxxxx7
Addressee: Item destined for abroad
Status: Arrival at inward Office of Exchange in the Country of Destination
Status from: 19.08.08 17:07
Process: Arrival at inward Office of Exchange in the Country of Destination

Everything here screams bad systems, poor understanding and disregard for the customer. They aren’t giving the customer what they want, they’re giving the customer a little of what they have and are not even reinterpreting the data from the customers perspective.

This isn’t untypical but neither of my questions have been answered and the item is over the delivery times so I need to go further. Hitting the contact button next to the “piece-number” takes us to:

For further information, please call us on
0 18 05-345 22 55 *
(14 cent per minute within german fixed network)

Business hours:
Monday - Saturday between 7 a.m. and 10 p.m.
Sundays and public holidays between 9 a.m. and 6 p.m.
* only within Germany

or per contact form (except for investigation inquiries)

If your shipment has not arrived at the recipient within 6 days, you have the opportunity to fill out an  investigation inquiry dircectly via your PC.

Wow, so the primary point of contact for an international delivery is a number that can only be called from Germany. Useless.

So we can now choose a per-contact form or an investigation form. Okay, let’s go to the investigation form. Let’s try that.

The web page you would like to access cannot be viewed at this time.

We apologize for any inconvenience. Perhaps it is due to a connection problem, perhaps the link is no longer valid or you have directly selected a page that no longer exists in the specified directory

Wow, DHL Germany really don’t have things under control here. Let’s flip over to DHL’s main site and take it from there.

First of all we need to chose our country, currently Canada… Now let’s enter the reference number we’ve been using on DHL Germany’s web site and “Shipment/Waybill not found”.

Okay, I’m a persistent fellow, let’s give DHL Canada a call and find out what’s going on… I give the reference number to the woman at the other end and “that’s too long”. Hmm, tell her it works on DHL Germany web site, she goes to the web site and tries it out and confirms it does but that it doesn’t work on their system. She tries a few searches on my name, from Germany to Vancouver, nothing, nada, zip and suggests I try contacting DHL Germany or the sender to get a “proper” reference number.

The real icing on the cake of course is the “About DHL” page states:

DHL Express offers seamless service worldwide.

I can see a very big seam here between Germany and Canada.

Expertise around the globe.

Not much use when the people with that expertise are sat behind a number you can’t call from outside their country.

One world. One express and logistics company.

But not one system or tracking mechanism.

[)amien





Topics