Choosing an ORM for “Easy” SaaS Launch (ASP.NET MVC)

I am about to start developing a web application that I can best describe as a specialized version of the 37Signal Highrise contact management application focused on service companies such as lawn care. I decided to use ASP.NET MVC to take advantage of my membership in BizSpark and use the C # / ASP.NET / SQL Server that I already know.

I do a bit of research to choose an ORM for the project; I'm not sure if I should go with something easy, like LINQ to SQL, or go with the big NHibernate guns. At the moment, I do not assume that the application is overly complex. I essentially have these models:

  • Account
  • User (provided by ASP.NET, but I may need to expand it)
  • Customer
  • Job

where the following business rules apply:

  • The account is the main account (since it represents the subscriber), and everything else (users, customers, tasks) hang from it.
  • A client can have more than one job.
  • There are two types of clients: "lead" and "client." The idea is that customers can request further information from the form that we provide and automatically add to the customer database of the account, and then the employee can track and plan work that “transforms” leadership
  • The task can be one-time or set in a repeating schedule (for example, every two weeks, once a month).

I have a bad habit of trying to outsmart things. LINQ to SQL seems to fit my needs, but in the future I will be interested in scalability and the future costs of using more functional ORMs like Entity Framework or NHibernate will be query efficiency and optimization for myself. I am considering using Windows Azure to host an application.

Any thoughts?

+4
source share
6 answers

Your model seems simple enough to be supported by Linq2Sql, Entity Framework, and NHibernate.

The biggest choice you need to make is whether you want to follow the Driven Design-driven approach to modeling software or you want to work with your objects as database rows. If you want a fantasy when matching strings with objects, then NHibernate is the best choice. If your happy with a 1: 1 between your business objects and the rows of the Linq2Sql database and Entity Framework is just fine.

NHibernate and, to some extent, the Entity Framework supports POCO objects that are not inherited from the base class and may not be aware of their security requirements. Linq2Sql can, but its hacky and weird.

In terms of scaling, all three of these ORM tools take you pretty far. AFAIK NHibernate has more features when it comes to partitioning database servers and handling cross-domain database identifiers, and there is even some Sharding support.

NHibernate also supports most providers, you can switch from MSSql to MySql in an hour using Linq2Sql and EF (although support is not expected)

So TL; DR:

  • NHibernate, if you need better POCO support, more scalability and “there is a mapping for these functions to display row-> objects. FluentNHibernate is awesome. You have support for multiple providers.
  • Entity Framework, if you want to improve developer GUI support and are ready to wait for EF4, vs2010 for a full-featured ORM.
  • Linq2Sql if you need easy db access.

I used all three and I least like EF1, EF4 is better, but not as good as NHibernate.

I use EF4 with VS 2010 for all future “simple CRUD” applications and NHibernate when I need to get some fantasy.

+4
source

My experience is that the "initial cost" for the Entity Framework is about the same as LINQ-to-SQL for simple data models (assuming you have an existing database schema to work with).

A series of tutorials on how to start and run a simple Entity Framework model.

I'm not one of those, "LINQ-to-SQL is dead!" people, but it looks like Microsoft intends to invest more in the Entity Framework in the future. This tells me the scales a little in their favor compared to the L2S. ADO.NET's team blog is a good place to keep an eye on this.

+2
source

You might want to consider SubSonic. It seems to be aimed directly at your sweet spot.

After that, I would consider NHibernate. NHibernate has minimal flaws, and it can effectively scale in your project. With NHibernate, you don’t box yourself in a limited set of functions, like in Microsoft ORM and SubSonic.

+1
source

Inspired by the engine that stackoverflow.com launches, I have been working on developing a full-blown CRM and boxed business solution in the last few months. I had many reservations about using LINQ to SQL as an ORM (a discussion on stackoverflow.com and elsewhere indicated that the Entity framework was a “thing”), but I found LINQ to SQL a breeze with, even with its known limitations. With LINQ-to-SQL, I could build a fully functional CRM prototype in a few weeks. Currently, CRM is in the late stages of beta testing with a small number of clients, and some of them have a fairly large amount of use (1000 leading and several dozen users). So far I have not seen any noticeable problems with stopping the show with ORM / database.

I wrote a lot of SQL stored procedures (and used them with LINQ to SQL), which required very complex joins. Since I come from a SQL / Microsoft Enterprise Library database, it’s easier for me to write complex stored procedures in SQL and support basic CRUD operations within the LINQ to SQL level

indyfromoz

+1
source

I am currently completing an asp.net mvc application. We used the S # arp architecture. This is the "framework" that allows developers to use NHibernate, Fluent, and many other best practice tools (DI, etc.). Here is the link to the site.

http://wiki.sharparchitecture.net/

Our team absolutely loves this product and recommends everyone to add it to their technical arsenal when choosing paths to architecture.

+1
source

I would recommend the following:

  • S # arp architecture. It uses NHibernate but has a high preset, so you can start and run in just a few minutes - not only with data, but also with MVC and other useful things.
  • The implementation of ActiveRecord is namely the ActiveRecord Lock . Thsi is very easy to use, but you still need to understand a bit of NHibernate.
  • Linq to SQL with repository template. You will benefit from the simplicity of L2S while you are ready for future changes. Just google for the "linq to sql repository".

As my ex-boss said: “No matter what you choose, it’s important to choose something and start working”; -)

0
source

All Articles