views:

67

answers:

1

I am trying to centralise the data access within my small company. The data I am wishing to represent in either a class library or a web service will be consumed by ASP.NET web applications (both Web Forms and MVC), ASP.NET desktop applications and Sharepoint (MOSS 2007) web parts.

This is all internal stuff, so is there any need to go for a fully blown web service (I am thinking ADO.NET Data Services) or should I just set up a Class Library project which uses Entity Framework (wrapped in a Repository layer most likely)?

+3  A: 

Since you're talking about internal usage, I assume you have no restrictions in place for connecting to your database from any of your endpoint applications. In that scenario, I prefer the direct interaction of a class library vs. a web service.

If any of your applications are migrated to a place where database calls are problematic (i.e., across the internet), a web service access layer is nice.

I've found that any library that goes directly against the DB is easier for troubleshooting db interactions than a pass-through web service.

In these either/or scenarios, I prefer simplicity. Start with a class lib using the Entity Framework. If you find you need a web service, move to that using ADO.Net Web Services (or even wrap your "Phase 1" EF library in a WCF service.)

jro
+1 good call - one less level of complexity always helps! :-) Keep it as simple as you can - only add additional layers like ADO.NET DataServices if you really need to.
marc_s