Author Archives: martijn

Raven DB ASP.NET Membership Provider

During the last year I’ve been looking at various NoSQL databases. I’m particularly interested in the flexibility (no fixed schema) and I don’t care that much for scalability that some of these databases provide, therefore I focused on document databases like CouchDB, MongoDB and Raven DB.

After some reading, I decided it was time for an experiment and took Raven DB to create an ASP.NET membership provider. The main reason I chose Raven DB is that you can run it embedded in your .NET application (for example in ~/App_Data) without a separate server and it’s even possible to run the entire database in-memory, which is ideal for tests.

The result of the experiment can be found at https://github.com/martijnboland/RavenDBMembership. It’s a VS 2010 solution with the membership provider, some integration tests and an ASP.NET MVC 3 sample app. You can also directly download it from here.

Disclaimer:

I’m not sure that creating a Membership provider was the right thing to do to experience NoSQL. Sure, the provider works, but the Membership API forces you into a direction that isn’t necessarily suitable for document databases and there might be some NoSQL anti-patterns here and there in the code

Oh, and the ASP.NET MVC sample app extends the Membership mess that comes with the default MVC project template. Don’t take this as some best practices example.

Cuyahoga 2.0 revisited

There is a new Alpha version of Cuyahoga 2! Read the official announcement here.

image

Entity Framework 4 Code-First demo updated to Feature CTP3

The EF 4 code-first demo has been updated to reference the EF4 Feature CTP3 dll at its default location. To run the demo, you have to make sure that the you have it installed. Download the EF 4 Feature CTP3 at http://www.microsoft.com/downloads/details.aspx?FamilyID=af18e652-9ea7-478b-8b41-8424b94e3f58&displayLang=en.

Although the demo was originally developed with VS 2010 Beta 2 everything works perfectly fine on VS 2010 RTM.

You can find the demo sources at github: http://github.com/martijnboland/EF4-codeonly-demo where it’s also possible to download the sources all at once.

Staying out of .NET Open Source dependency hell

Probably all consumers of Open Source .NET libraries have run into the following situation: you’re using specific versions of library X and library Y in your application but library X also uses library Y, but a different incompatible version. Aaarrrghh!!!

A classic example of Dependency Hell.

There are technical solutions out there that address this issue such as Horn or Maven for Java, but I think there is an alternative non-technical solution: Just reduce the amount of libraries that you depend on.

This might sound silly because why re-invent the wheel? Well, you don’t have to. Let’s take a concrete example. I was using MvcContrib’s Castle Windsor controller factory in a project, but then, when I upgraded Castle Windsor it didn’t work anymore. Of course there wasn’t a new version of MvcContrib released yet that depended on the new Castle Windsor, so I had to build a new version from source. Then I started looking at the code and realized that it was just one simple class from the library that I was using. So I created copy & pasted a Windsor Controller factory class in my own project and got rid of one external dependency. Yes, I’m promoting Copy & Paste development here!

Of course, I’m not advocating that you should get rid of all your dependencies, but it might be wise to have a look at the dependencies and evaluate if you can get without some of them with just a little bit of work. This can save you from a lot of trouble, especially when you’re the type of programmer like me that wants to run the latest and greatest version of everything but not wants to build everything from source over and over again.

What works for me is the following guideline: try to keep away from libraries that use other (non-Microsoft base class) libraries if there are reasonable alternatives.

The risks of learning a SharePoint alternative

A few days ago, I heard someone complaining about the risk of introducing a light-weight CMS as an alternative for the default SharePoint (MOSS2007) solutions. The main issue was the amount of learning that would be required to get productive in the alternative environment.

Now let me throw in a bold statement: if your developers have managed to handle the complexity of a SharePoint solution, they can easily learn an alternative. The only risk is that they don’t want to go back ;) .