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 ?
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With