Tuesday, February 9, 2010

NDbUnit v1.6 supports Oracle

A new version of NDbUnit was released and Oracle support has finally been integrated.

This now brings the complete list of supported DB targets under NDbUnit to six:

  • Microsoft SQL Server (including Express Editions and on up to Enterprise)
  • Microsoft OleDb-supported databases*
  • Microsoft SqlServerCe/Mobile Edition/whatever its called this month
  • MySql
  • Oracle (including XE and on up to Enterprise)
  • SqlLite (including both on-disk and in-memory variants)

SmtpClient deliveryMethod

One of the nice but little known possibilities of the System.Net.Mail.SmtpClient class is the ability to drop emails into a location on disk. This makes it very easy to test your code without the need of an SMTP server.

Update your app.config or web.config like this:

   1:  <system.net>
   2:    <mailSettings>
   3:      <smtp deliveryMethod="SpecifiedPickupDirectory">
   4:        <specifiedPickupDirectory pickupDirectoryLocation="c:\mails\"/>
   5:      </smtp>
   6:    </mailSettings>
   7:  </system.net>


You can also configure this setting on the class itself. Files are dropped on the specified location and can be opened using Outlook Express or Windows Mail.

SQL Server – Get current user

Today I needed to know the current user while executing a trigger to write some audit data.

Getting the current user is very easy using following statement:

   1:  SELECT SYSTEM_USER

SYSTEM_USER will return the  name of the currently executing context. If the EXECUTE AS statement has been used to switch context, SYSTEM_USER returns the name of the impersonated context.

Enterprise Library 5 and Unity 2 Beta 1

After a very long silence, we finally hear again from the Microsoft Patterns & Practices team. They just released both Enterprise Library 5 Beta 1 and Unity 2 Beta 1. There a lot of improvements, I especially like the easier configuration and we finally got rid of the objectbuilder.

Downloads here:

VS 2010/.NET 4.0 RC

Start your download engines! Microsoft made available the VS2010 and .NET 4.0 release candidates. You can find download links here.

Right now the downloads are available only to MSDN subscribers.  Starting Wednesday (Feb 10th) everyone will be able to download them (regardless of whether you are a MSDN subscriber or not).

More info here.

Saturday, February 6, 2010

Sharepoint sucks… or that is what some people are saying

For some strange reasons, people get very religious when it comes to loving or hating Sharepoint development.

Bjørn Furuknap did a great blog series on this discussion. Read al posts to get the point…

Multiple endpoints for a WCF service hosted in IIS

Last week I had to deploy a service with multiple endpoints in IIS.

In this case my WCF service has 2 addresses, a base address and an endpoint address.

The base address is used for meta data. It matches to the SVC file we’ve created to host our service in IIS. So if a consumer uses our service. It will extract the WSDL metadata from this address. In your browser you will only be able to access the base address.

For example, http://localhost/IBuySpy/OrderService.svc

Inside your service,you can have an address for each endpoint. When you are actually calling the service, you will not be using the base address but one of endpoint address.  Most of the time I configure my service so that for one address the base address and endpoint address are the same.

So when you are calling the service from a client app,you can use both addresses,

http://localhost/IBuySpy/OrderService.svc

http://localhost/IBuySpy/OrderService.svc/Endpoint2

The corresponding service configuration will look like this:

   1:  <system.serviceModel>
   2:     <services>
   3:        <service type="IBuySpy.OrderService">
   4:           <endpoint address="" binding="basicHttpBinding" contract="IBuySpy.IOrderService"/>
   5:           <endpoint address="Endpoint2" binding="wsHttpBinding" contract="IBuySpy.IOrderService"/>
   6:        </service>
   7:     </services>
   8:  </system.serviceModel>