# Thursday, 25 October 2007

anug_logo_200x85 We had our fourth successful meeting yesterday evening in the fine offices of Ditmer. A lot of people turned up for this one I guess LINQ is something which is on most .NET developers minds these days as I counted approximately 30 people attending this one. We even had some guys from Nordic Company coming all the way from Copenhagen to attend and Niels Hartvig of Umbraco fame decided to take the trip from Fyn as well which I believe is a testament to the fact that we're doing something right with this thing.

Usergroup News

As always I started out by telling everybody about the things we've been doing with the usergroup since the last meeting. This time around we've had a lot going on and I was looking forward to announcing it all and getting people's response on it.

Logo and Web Site

We've got ourselves a logo courtesy Lars Øer who is a regular attendee at the meetings and also a colleague of mine. As you can see we're already using here and on our LinkedIn group (which you should join if you haven't already done so :)). With the logo done we're hoping to move on to the design of the ANUG.dk site and get that done before the end of the year additionally we'd like to provide a more structure schedule for our upcoming events which should make it easier for you to sign up and get an idea of where we're going. we basically need some kind of custom control for BlogEngine.NET so feel free to go nuts and do one if you'd like ;)

November 28/11: Getting Started with Professional .NET

First up is our next meeting which will be for those of you who want to learn same of the basic .NET stuff and tools you're going to need. The session is called Getting Started with Professional .NET and it's scheduled for 28/11 at Scanvægt. More details will follow shortly but the basic idea is to cater to people in our group who are there to get started with .NET and learn a couple of tricks along the way.

December 14/12: Geek Christmas Dinner

For our final session this year we decided to do something a little different and throw a geek Christmas dinner. We really don't think that a session the last Wednesday of December would garner any attendees at all so instead we're doing this. There are 15 seats available for now but we've got the option to bump that number if we see a lot of interest. You need to RSVP no later than 23/11. Due to some planning constraints we have to make attendance binding for this one. As with the November meeting more details will be up shortly.

March 01/02: Code Camp .NET for Beginners

As a follow-up to our November meeting we're going to do a code camp where we'll build a three tier .NET web application using the tools and best practices which are considered essential for a .NET developer. We'll be digging into data access, domain models, UI design.

This will basically be an entire day of .NET where you get the opportunity to get your hands dirty in your own solution with the help of our coaches who'll guide you through the day. I think this is going to be a lot of fun and even better it's a great way of digging deeper than we usually do that the regularly scheduled meetings. Hope to see you there!

We're still looking for a place to hold it but I'm not too worried about that as we've got a number of possibilities already. Also we're looking for sponsors to provide food and drink for the attendees so if you're working at a company that needs some attention feel free to contact me about the details.

Ideas for Upcoming Events

While the group was just getting started we decided to go ahead and put together as many events as we could without taking any input from the attendees but the vision is to allow you the attendee to decide what you want us to talk about. We got together a nice list of topics and surprisingly F# topped it out with the most votes so I guess we're to do an F# session soon, we just need to find someone who knows something about it, hint hint nudge nudge :)

Other topics on people's minds are, number of votes is in the parenthesis, we'll definitely take these into consideration, specifically I'd like to do a couple of sessions of Visual Studio 2008, C# 3.0, and VB 9 with their release imminent.

•    VS 2008  (11)
•    Silverlight 1.1  (11)
•    Team System (foundation + client)  (10)
•    C# 3.0 / VB 9 (new language features,difference between version, when and why should you upgrade) (9)
•    PowerShell (9)
•    DLR / F# (8-12)
•    WF (7)
•    WCF (9)
•    ASP.NET MVC Framework (+10)
•    Compact Framework (7)

JAOO Cooperation

Briefly after JAOO 2007 I was contacted by Kresten Krab Thorup from Trifork who suggested that we do some kind of cooperative effort with the JAOO guys next year. There are no solid plans as of now but it's definitely something we're going to pursue in to get a super star or two to speak at one of our humble meetings.

With my intro done I yielded to floor to Søren Skovsbøll the main attraction of the evening...

ORM and LINQ, Søren Skovsbøll, Ditmer A/S

Søren did a very cool and thorough presentation of ORMs in general and LINQ to SQL in particular. He gave an insightful view into the wonderful wacky world of ORM and all the patterns surrounding the various implementations like NHibernate, LINQ to SQL, and even his own implementation Matternhorn all the while relating the information to LINQ to SQL to give us an idea of what to watch out for when doing LINQ to SQL projects.

Although Søren said that he in no way was an expert on LINQ to SQL I came away with a sense of knowing the product better because of his insight into the general principles of ORMs. When I first saw LINQ to SQL back in 2006 demoed by Anders Hejlsberg I was ready to drink the cool aid and go all out with it. Søren's presentation was sobering as he pointed out not only all the good things about LINQ to SQL but more importantly all the problems, something you won't see from a Microsoft presentation I think :)

I still think LINQ to SQL is a cool product but from Søren's presentation I think it's clear that you need to know what you're getting yourself into before taking the plunge.

Tour de Ditmer, Morten Ditmer, Ditmer A/S

With our break done Morten spent some time telling us about Ditmer and the way they operate as a company. Ditmer is a very agile company with focus on delivering software rather than bickering over contracts with the customer as a result they don't employ contracts at all which Morten felt obligated them even more to deliver real business value to their customers. Another aspect of this is that they've got no sales force; every new project comes in by word of mouth which to me is interesting as I've seen very good ideas tank because they didn't get the attention they deserved. Probably the reason that this is working is the fact that they've got traction in the marketplace already and their network is allowing them to operate like this. As a result they're a very developer centric company which should appeal to most .NET'ers out there :)

There's no question that Ditmer is an great work place where all the right values are in focus. They're even involved with Agile Alliance another plus in my book :)

Open Forum (The Artist Formerly Known as The Nutcracker)

Even though it was getting pretty late most attendees stayed around for the open forum where we had a very good question about how to do internationalization and a step beyond that: How to change logic and appearance based on locale you're currently operating in. In addition we covered scaling an web application for a lot of users across multiple continents. Although people we tired I think we got some good answers and food for thought on this one. As always I encourage you to think on topics for Open Forum in advance so we get the most out of the time we've got.

posted on Thursday, 25 October 2007 14:36:22 (Romance Daylight Time, UTC+02:00)  #    Comments [4] Trackback
# Tuesday, 23 October 2007

anug_logo Be sure to attend the most requested session of ANUG ever: ORM and LINQ with Søren Skovsbøll. If you want an opportunity to learn more about LINQ and ORM in general this is a must for you! :) Also you'll get to meet a lot of interesting people what's not to like?

It's absolutely free to attend and Ditmer will provide some snacks for us so be sure to check Wednesday 24/10 19:00 (that's tomorrow evening). More information and to sign up.

posted on Tuesday, 23 October 2007 10:30:35 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Monday, 22 October 2007

How's this for error handling? :)

Human-Error-Handling

posted on Monday, 22 October 2007 10:06:42 (Romance Daylight Time, UTC+02:00)  #    Comments [2] Trackback
# Monday, 15 October 2007

Commerce-Server-2007-Logo  We're working on a couple of Commerce Server projects right now and common for both of them is the fact that we need to support multiple currencies and languages. "That's easy", you might think, "you just add additional languages to the catalog and you're done". Indeed that is the case for multiple languages but it turns out that supporting multiple currencies is a little more involved.

Requirements

Of course I need to support multiple currencies and languages but also multiple price groups so I can have different prices in countries using the same currency, say Spain and Holland where both use euro. Also I need to support pretty prices, i.e. the business user can specify the price like $9,99 or kr 5,95. I don't want to link a single currency to a particular country, e.g. I want Danish customers to be able see prices in Danish kroner as well as euro (the Danish euro price and not the Spanish one as they may differ).

Finally I need to support BizTalk integration with an ERP system with an internal category structure which makes sense to the business users and an external category structure for retail customers as defined by marketing. Of course I want all this to fit well in the Commerce Server way of doing this without compromising architecture and maintainability.

Requirements summed up:

  • Multiple languages
  • Multiple currencies
  • Price groups
  • Don't link currency to country
  • Internal hierarchy and completely different external hierarchy
  • Fit into CS way of doing things

Commerce Server Support

There are a number of features in Commerce Server which can help me support my requirements it's just a matter of using them in the right fashion to achieve the desired end result. Multiple languages are supported right out the box simply by specifying on each catalog which language to support. From there on in you can switch language when you're viewing any item in the catalog and edit text in whichever language you want. The catalog schema is fully extendable so you can use that to add a new field for each currency or price group you wan to support. We have virtual catalogs which allow you to move a product from another catalog into the virtual one and override values there. Finally we have catalogsets which is a way to bundle catalogs together and associate them users or groups.

In summary we have the following tools to work with:

  • Multiple language support on catalogs
  • Extendable catalog schema
  • Virtual catalog for overriding field values
  • Catalogsets to associate catalogs to users

What Not To Do

Now you could go ahead and use the multiple language feature to support multiple currencies but there are two problems with that: 1) Numbers are not overridable like text so you can only specify a single value across languages, you can remedy this by creating a text field and override that but then we'd be working with text values instead of decimal values and you would need to make modifications to the standard pipeline components which are looking for the ListPrice field on the products. Additionally you'd have to come up with a naming scheme for languages if you want to support multiple currencies in the same country essentially creating redundant text data because of it.

As a better alternative we could create new fields for each currency but it would break our requirement of maintainability as we'd have to create a new field each time we want to support a new currency. Even worse we'd have to come up with a naming scheme to support the same currency but in different countries, e.g. Spain_EUR_ListPrice, Holland_EUR_ListPrice, and come up with code which can support it in our pipelines. Interestingly this is one of the scenarios Microsoft is pushing needless to say that I don't agree in the least with this recommendation. Also each catalog in Commerce Server has a base currency specified which would be rendered useless or even worse would confuse the business users.

Using multiple fields would however make the integration story very easy because we simply map the fixed fields coming from the external source to Commerce Server.

What To Do

This is how I propose we solve the problem using virtual catalogs. Everything needs to be imported into a single base catalog which won't hold any price information, optionally you could use the base catalog for the currency which the company operates in internally but for our purposes I'll leave it blank as to only have a single model for multiple currencies.

Virtual Catalogs for Currency and Price Groups

Remember that each catalog in Commerce Server has a currency configured we'll leverage that by creating a virtual catalog for each currency we wish to support additionally we'll need to go one step further to support our price groups. In order to do that we'll extend the catalog schema with a field called price group which along with the currency will identify the correct catalog to look for when displaying products to the retail customers and when BizTalk is updating. To make the solution more maintainable we do a single "include all"-rule for each of the price group catalogs which will allow the BizTalk developers to assume that the product will always be present in all currencies, of course you can elect not to this but it will need a higher level support either manually or in the integration piece.

Base catalog - virtual catalog

Now I mentioned include rules in passing above so allow me to elaborate on them here a bit: To include products, variants, or categories from another catalog in a virtual catalog we do it by creating virtual catalog rules. We have four types to choose from: Include everything, include category, include product family, and include variant; for each of those you can specify that we're excluding instead of including. There's a fifth rule type which I'll mention for the sake of completeness though I won't use them in here: pricing rules which is a way of adjusting prices in the catalogs. In summary I chose an "include all"-rule to support my price group catalogs above which will bring in all categories, products, and variants which are imported by BizTalk.

Support for BizTalk Integration

Whenever BizTalk imports a new product it needs to lookup the correct price group catalog for each price group on the product and update accordingly while this makes the integration piece a little more complicated it allows the Commerce Server developers to use the product in the intended way.

Virtual Catalog Considerations

For maintainability it's important to only update price information in the virtual catalogs we've created. Updating anything else will break the override chain which means that future updates to say product description will not populate to the virtual catalogs in which we overrode the value. It may be what you want but you need to be aware of this behavior.

Custom Hierarchy for Retail Customers

Remember that we want to provide the business with the opportunity to completely customize the category hierarchy for the retail customers while maintaining an internal hierarchy which makes sense from a business point of view. Now we have the business view of things in our Import catalog which is reflected in our price group catalogs as well due to the "include all"-rule we've added to the catalogs but we need a way to do a different hierarchy for our retail customers.

Unfortunately we can't do an "include all"-rule because that effectively includes categories as well and once you've included a category you're effectively stuck with it in your virtual catalog, there's no way to remove it without removing the products within as well. This means that we need to do include rules for every product family we want to include which provides the ultimate flexibility but also requires more from the Catalog Manager tool. Basically you can do with Catalog Manager but that doesn't mean that you should :) The workflow for adding an include rule basically involves opening the virtual catalog, clicking rules, then add new rule, search for the product you want, select the product, click next a couple of times, and then you need to add it to your new category in the virtual catalog which is another couple of steps. Imagine doing that for 4000 products :) Obviously some work need to be done on the Catalog Manager to make the workflow more smooth, maybe drag and drop within the catalog hierarchies or some kind of two-pane UI with the two catalogs on either side. In any event something needs to be put into place to handle the workflow but that's for a different post.

With that done we have something like this:

Multi-currency-and-pricegroup-with-commerce-server-2007

Finally we do a catalogset for each required user segment to line up the catalogs for the correct users programmatically. Once that's done we should have all our requirements covered.

In Conclusion

Working with Commerce Server to support our requirements is essential even though it might involve a bit extra work to get there. We could've added an extra field for each currency we needed to support but that would have cornered us and ultimately created a less flexible system which might not support us in the future. We want to work within the restraints of Commerce Server without jeopardizing our systems design which in the end would render the decision to go with Commerce Server useless.

With an integrated solution it's important to keep in mind the opportunity which we have to keep some of the ugliness found in the systems we're integrating with at our system boundary enabling us to stay with a nice and clean design.

As with any standardized product it's important to know the tools available to us and how to use them in the correct fashion. Our little exercise above shows some of the capabilities of the catalog system and how you could leverage them to achieve a flexible solution while not compromising the design.

posted on Monday, 15 October 2007 11:15:56 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Thursday, 11 October 2007

It turns out that I was lying when I proclaimed my upgrade to DasBlog 2.0 a success as I had a small bug. Apparently you need to change a config value in web.config which pertains to how ASP.NET 2.0 handles cookies otherwise you cannot use the Remember Me functionality when you login to view config, referral stats, etc.. It even says so in a friendly comment in web.config but of course you need to look for it :)

Uncomment <httpCookies httpOnlyCookies="false"/> in web.config and you're good to go. Remember this only applies if you're running it under ASP.NET 2.0 which is always the case with DasBlog 2.0 but not so with 1.x.

posted on Thursday, 11 October 2007 14:13:18 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Wednesday, 10 October 2007

You're probably already heard the buzz about Microsoft releasing the code for the .NET Framework. I've held my tongue on this subject for a while because I wanted to formulate my own opinion on it instead of just doing the obligatory YAY-post. My stance on the subject is not as glowing as others I've seen during the past week.

In many ways I'm more excited about the new MVC framework than I am about the release of .NET Framework source code. Sure it's great to be able to step into the implementation of some class from the BCL but we've had that ability forever with Reflector. It's not THAT often I've had to bring out the big guns to debug a problem; in 99,9% of the cases the problem is not with the framework itself it's with our custom code. I fear that some people will start hunting for bugs in the framework instead of sitting back and actually considering the bug they're seeing before trying to debug it.

I'm not sure that the problems with patent infringement as outline in this post will be a problem but it certainly is something to keep in mind with the litigious environment in the United States.

I don't mean to belittle Shawn Burke's effort because he certainly did a very cool thing in getting this thing out there and he's been working on it on and off for a long time. He actually blogged about it the first time back in 2005 albeit in a less ambitious scope also check out his follow-up about the actual release. Much more interesting is the fact that the system they've set up will work for any product group which want to release source for their particular product; we probably won't see the source code for BizTalk floating around out there but there certainly are some interesting implications in this if their idea is carried beyond the framework itself.

What I like about this new development is the fact it's a manifestation of a more open and transparent Microsoft, we've seen it for a while now that the company is more open via the blogs and more recently with the open source announcements for ASP.NET AJAX Control Toolkit and IronRuby. The idea that Microsoft would release source code a few years back was preposterous but now we're seeing much more effort to support the community around the products which in turn I'm sure will bleed into the community itself and create more open source initiatives on .NET than what we have today.

posted on Wednesday, 10 October 2007 09:30:57 (Romance Daylight Time, UTC+02:00)  #    Comments [3] Trackback

I first heard about the new MVC paradigm for ASP.NET coming form Microsoft at JAOO when Oren Eini mentioned it at the MonoRail talk at JAOO. At the time not much information about the new frontend framework was available but with Scott Guthrie's announcement of it at ALT.NET information is starting to trickle out. Scott Hanselman has even more information on it including full presentations of actual code from the conference (done in Silverlight naturally).

While MonoRail has taken these ideas and run with them for a while it's great to see Microsoft stepping in with their own implementation as I strongly believe that that is the only way to create the adoption rates needed for people who need to get their job done.

I'd like to adopt a framework like MonoRail but in doing so I'd effectively cut customers and team members from access to third party controls built for WebForms and even worse we'd have to invest heavily in training new hires on MonoRail before they can effectively participate in projects when in fact I could spend that time training them on technologies which effectively bring much more value to the table like Commerce Server and SharePoint.

posted on Wednesday, 10 October 2007 09:05:21 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Tuesday, 09 October 2007

VisualStudioLogo Have you ever spent more time looking for the item you wanted to add to your project than actually writing the code for it? I've spent plenty of time not being able to find that particular item in my Add New Item dialog because Microsoft just threw everything in there with a huge pitch fork.

Luckily for us K. Scott Allen found this annoying as well and went digging in the Visual Studio project templates and found that he could sort the list using a little Powershell script he did.

So he went from this to this:

clip_image002image

Download his Powershell script for sorting the Add New Item dialog and remember to grab Powershell as well to make it go. Please note that Powershell has policies in effect which means that you have to allow the script to run. I simply did a Set-ExecutionPolicy Unrestricted and then ran the script. I know I shouldn't be allowing all scripts to run but I don't really use Powershell for anything serious at this point so it doesn't matter.

Thanks to Daniel for this tip.

posted on Tuesday, 09 October 2007 18:23:54 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Monday, 08 October 2007

As I mentioned in my summary of the last usergroup meeting we have a little more mainstream topic for the next meeting: Object relational mapping (ORM) and LINQ.

The next meeting will be held October 24th 19:00 at Ditmer A/S. Please note that we're not doing the last Wednesday this time around due to scheduling conflicts with the speaker. As always the meeting is open to anyone who wishes to participate.

Please leave a comment to sign up for this meeting

Practical Information

The meeting will be held:

Wednesday 24/10 at 19:00

at:

Ditmer A/S

Trindsøvej 9

8000 Århus C

Map

Agenda

Usergroup News

To keep everybody inform on the various stuff going on we'll begin with a short update on planned sessions, new initiatives, and so forth. This will also be your chance to give us some feedback on what you would like to see at future meetings or voice your interesting in presenting a subject matter yourself.

Object Relational Mapping and LINQ, Søren Skovsbøll, Ditmer A/S

O/R mapping is a widely used discipline in the .NET world. Only now Microsoft is entering the fray with two O/R mappers: LINQ to SQL and later ADO Entity Framework. LINQ to SQL has garnered a lot of publicity primarily due to the new query language which is available inside C#, VB, and other CLR languages.

Getting started with LINQ to SQL is easy but when your applications become more complex than the samples Microsoft provide you'll need to know what's going on under the hood and what an O/R mapper really is.

We'll dive into which patterns also all O/R mappers use: Identity Map, Unit of Work, Data Mapper, etc.. LINQ to SQL is a simple O/R mapper in that regard but making up for the fact are the rich design time tools which comes with Visual Studio 2008.

Søren Skovsbøll is  a development consultant with Ditmer A/S. He started working with O/R mapping when NHibernate was in its infancy with the 0.3 release. Mappers which will let you keep your domain model nice and clean is in high regard with Søren and he's even built his own O/R mapper from scratch called Matterhorn which was the first to support generics. He publishes a blog at Skarpt.dk.

Break

Tour de Ditmer

Morten Ditmer, the CEO of Ditmer, will do a lap around his company and enlighten us on Ditmer as a company, their values, and how they go about building software in Ditmer.

The Nutcracker

Have a problem or a topic you'd like to discuss? This is your chance to get the opinion from a bunch of intelligent people working with .NET. Would you like to demo a cool tool? Show a web site which has changed your life? It's all up to you, if you find it interesting chances are that others will too. So feel free...

Looking forward to seeing you and remember not to be shy even if this is your first attendance :)

posted on Monday, 08 October 2007 15:59:29 (Romance Daylight Time, UTC+02:00)  #    Comments [30] Trackback

He's no Singing Salesman but he sure got talent. Without further ado I give you hands farting Bohemian Rhapsody. (Blame our sales guy Robert for this one :))

posted on Monday, 08 October 2007 14:03:14 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback