Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good architecture for 2-tier(client-server) desktop application using linq-to-sql

Our present architecture - UI,BusinessLayer,DAL(generated linq-to-sql).In the DAL layer, we have added validation logic for entities in partial class. We are directly using entities generated by linq-to-sql in businesslayer(which is bunch of classes - class\form).Also, in these bll classes,we create linq-to-sql queries.

I feel we could layer the application better in terms of MVP pattern, and have service classes which provide data using linq-to-sql.What do you think? Should I consider repository pattern ? Would that be an overkill ?

like image 875
junky_user Avatar asked Feb 15 '10 18:02

junky_user


1 Answers

It is a good idea!

Your choise depends on your application, but these are many problems:

1) The transformation between the object database model and object model application can be much more difficult. In such cases, it is impossible to implement filters on a model for the application so that the resulting query can be trasmited into SQL.

2) Often, as a result of sampling necessary to obtain the result of the connection (JOIN) multiple tables, and not only data from one table

3) Not all SQL-operations and functions have their equivalent in LINQ

What about Entity Framework? Please, don't touch Entity Framework. It is heavy and slow thing! :)

I prefer classical data access via stored proc and Data Access from MS Enterprise Library. I can use the power of SQL and flexibility my own Business Entities. And of course - performance! The reverse of the medal is more work. I used some tools to autogenerate data access objects and then fix them as I need.

Luck!

like image 115
garik Avatar answered Oct 26 '22 23:10

garik