views:

551

answers:

2

I am designing this HR System (desktop-based) for a mid-size organization. The thing is I have all the tables designed and was planning on using the O/RM in VS2008 to generate the entity classes (this is the first time I work with OR/M; in fact, this is my first "big" project.) I wanted to make the app with 3 layers (one of the programmers of the company suggested not 3 but 4 or 5 layers) but after reading quite a lot of blog entries and a lot of questions here I've realized that is not quite easy to do that with LINQ to SQL because of how the datacontext works and how difficult it is to pass objects between layers using LINQ to SQL.

Probably I'll just use the entity classes generated by the VS2008 ORM and add any validation and bussines logic in partial classes. But that would be 2 layers, or not? The app will be used by like 10 users, so I don't think the 2 layer approach is a big issue for now.

In the future, a web-based front-end will be developed so candidates can apply to jobs online. I want to develop it as scalable as possible. But the truth is I don't have a lot of time to waste to make a decision, times running up hehe.

Having said all that, should I just use the entities generated by the VS2008 ORM?

So any suggestion or idea would be greatly appreciated. Thanks.

+1  A: 

You're chewing over quite a lot with your line of questioning here. (Is there a concrete question hidden in there somewhere?)

With layers, I assume you mean physical boundaries, i.e. application, app/SOA/WCF server, data layer that lives on the SOA server, and a database somewhere.

Designing for the future might seem like a good idea, but DO make sure that there WILL be a need for all those layers somewhere down the line. Essentially, you do not need a WCF/SOA based approach if you're not exposing your application over the internet at some point. A web frontend can solve the same problem in many cases.

I'm not saying you will not need those layers at all, but you might not. If you really do, seams are your friend. You need to make "cut points" where you can define your boundaries. I commonly use the repository pattern to diversify data access methodologies, and use plain objects (POCO) and interfaces that are persisted via technologies such as NHibernate. Using POCOs also makes it MUCH easier to transfer those objects over the wire at a later point, either standalone or part of messages.

Creating service interfaces that are called can solidify your boundaries. When you are ready to move cross-machine/physical boundaries, you simply create your boundaries in the service implementations.

HenningK
Sorry for the formatting. I think it is clearer now.
jasonco
Thanks. I think I get your point of not over-engineering the whole thing. Like keeping it simple but no simpler.
jasonco
+1  A: 

It sure sounds like a dangerous way to go - creating the tables first, then domain and finally GUI. I must admit I am no expert on ORM expert but the generated classes I´ve seen looks more like dataobjects than classes. I would say you need another layer to stop all logic to end up in the GUI ).

zzzuperfly
Actually, after a little bit of research I found out that Microsoft propose exactly doing what I mentioned here. That is, generating the entity classes and adding all business logic and validation in partial classes of the entity classes:http://msdn.microsoft.com/en-us/library/bb882671.aspx
jasonco
Thanks for the help buddy.
jasonco