Using S#arp Architecture With Templify for ASP.NET MVC Solutions

All new projects start out the same way: a project folder is created, subfolders are created for different artifacts, assemblies are added, and so on. A new Visual Studio solution doesn’t take into account best practices such as a branchable folder structure or how best to organize your referenced assemblies, where your automated build process should be located, or which common reusable frameworks and tools you use in every project.

What Templify does is allow you to pick a particular architecture, right-click on your new project folder, and it automatically creates all the proper folders, deposits all the resources in the correct places,adds assemblies and scripts. Templify gives you a complete best-practices buildable solution 100, percent ready to start working on.

It's a real time saver, and when a team all embrace the architecture, it makes development more productive, faster, and easier.

You can download the latest version of Templify here to get started: and install the product.

Next, download and install the S#arp Architecture distribution here:
There is a batch .cmd file that will deposit the correct files in a user folder.

Create a new folder for your project via Windows Explorer. Right-click on the folder, and choose "Templify Here".  When the dialog comes up, choose your installed architecture, enter a name for your solution, and click the "Deploy Template" button. This will create a folder with your solution's name, along with a complete infrastructure and Visual Studio 2010 solution with folders Common, Packages, ReferencedAssemblies, and Solutions.

You can load the Solution file in Visual Studio and build your project, which will have the following structure:

Your S#arp Architecture project is now setup and ready to go. The latest release is built on the RTM version of ASP.NET MVC 3 and .NET 4. The only tasks remaining are to:

Create your database if needed and set the connection string within Web/NHibernate.config. Optionally, modify the Fluent NHibernate preferences within Data.NHibernateMaps.GetConventions() if you don't like the default settings. There's lots of info about Fluent NHibernate at

Open  Tests.dll via NUnit (or if you use Resharper, right click and choose "Run Tests" and make sure all the tests are turning green.
Add your first entity with CRUD scaffolding via /Code Generation/CrudScaffolding/ (If you include a namespace, be sure to setup the appropriate view area within Web.Controllers.RouteRegistrar.RegisterRoutesTo() after the scaffolding generator has completed.)

You're now ready to build your models, controllers and Views. S#harp Architecture is based on NHibernate, but you can use any ORM you want, such as Entity Framework, or one of the newer micro-ORMs like Dapper-dot-net. To find out more about S#arp Architecture, visit this wiki page:

By Peter Bromberg   Popularity  (10084 Views)