S#arp Architecture

I’ve been poking around in the latest release of the S#arp Architecture over the last couple days. I like what I see.

Pronounced “Sharp Architecture,” this is a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate.

This evening I took about an hour and converted the basic starter solution template from C# to VB.Net. Why? Well, for the following reasons:

  1. While I can work with C# well enough, I’m much more familiar with VB.Net, which I am required to use at my 9 to 5 job. I tend to stick with VB.Net even for my personal projects for simplicity. Anything I learn on my own I can easily apply at work.
  2. It gave me an opportunity to confirm that I understand (at least at a high level) what the S#arp Architecture is doing.

The conversion was straight forward. Pretty well every line of C# had a corresponding line in VB.Net. The only thing I had to add was an Imports tag in the markup of the Site.Master page in order to get the ActionLink and Image extension methods to resolve. I had already tried adding an imports to the code-behind with no luck. Not sure why that was necessary, but it worked.

The architecture is pretty neat. Here’s a few things I’ve noted already:

  • The Models, Views and Controllers (I.e. the M, V and C in MVC) are each in their own projects.
  • The Repository/IRepository pattern is used, with the Interfaces defined in the same project as the Models, and the Repository implementation(s) in a separate project.
  • Includes support for NUnit, Castle Windsor, (Fluent) NHibernate, and Rhino Mocks
  • The ASP.Net MVC routes are defined in the Controllers project, not in the Global.asax of the Web/Views project. Excellent separation of concerns!

I’m going to go ahead and trying putting together an actual application based on S#arp Architecture.

3 thoughts on “S#arp Architecture

  1. Hello,

    Were you able to convert this code into VB? And can you share the code?

    container.Register(
    AllTypes.Pick()
    .FromAssemblyNamed(“Northwind.Data”)
    .WithService.FirstNonGenericCoreInterface(“Northwind.Core”));

  2. @drammer

    Should be:

    container.Register(AllTypes.Pick().FromAssemblyNamed(“Northwind.Data”).WithService.FirstNonGenericCoreInterface(“Northwind.Core”))

    You’ll need these 3 imports:

    Imports Castle.Windsor
    Imports Castle.MicroKernel.Registration
    Imports SharpArch.Web.Castle.WindsorExtensions

  3. Brilliant!

    Now I can say I’m rusty on VB.Net. I did not think I have to do an “Imports” on an NotInheritable class. With C#, we don’t have to do that.

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>