What did we learn this week? Week of 19 januari 2009

Links for this week:

Global namespaces
I wanted to name a namespace “CompanyName.System” which turned out to be a bad idea: it gave me the unfortunate compiler error “The type or namespace name ‘SomeClassName’ could not be found”. The solution is easy according to the MSDN article How to: Use the Namespace Alias Qualifier (C# Programming Guide) but unfortunately the error happened in the designer file of a Windows.Form and there is no point in changing any code there. I suppose Microsoft should use the global:: identifier in generated code but they don’t. Or is there a solution I’m overlooking?

WCF Service hosting and Client access in a Windows Forms application
Actually, I came across this one too late. Last week I made a test application which was I simple Windows Forms application whome hosted a WCF service and connected to that same WCF service. A big NO GO was the result, as this guy also experienced…

WCF Services with constructor parameters
I eventually didn’t use it, but I had a use case this week for having a WCF service in which the constructor would have some parameters. An alternative could be to provide the object instance to use for implementing the service yourself instead of letting WCF instantiate it for you as the standard behaviour is. Again, I’m not the first one willing to do this as these links prove:
Unity & friends: The WCF service host side
WCF Dependency Injection Behavior
WCF Service Dependency Injection

Generics in .Net
I’m still getting used to this. Comming from a C++ background I’m still suprised by compiler errors trying to use a template parameter as a base class, or as an attribute parameter. In C# this is not allowed. Why? Read these posts:
Generic argument as a base class
Generic argument as a base class
Using Generic Parameter as an Attribute constructor parameter


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s