I have an asp.net mvc 2.0 application that has fields / modules such as calendars, administrators, etc ... In cases where more than one field is required to reach the same repo, I am not sure where to put data access layers and repository
First option: I have Data Access Layer Files with Repositories for each Region (SQL should be created in my case), so there are only tables and repositories in each area. The benefit required by those areas
The advantage is that whatever was necessary to run that module , That is a place, so it has been explained more (even in my mind). The downside is that I can have duplicate questions because other modules can use the same query.
Second option Or, would it be better that DAL and repositories outside the field and consider them global?
The advantage is that I will not have any duplicate queries, but I can load some unnecessary queries and load the DAL tables for some modules. There is more work to reuse or modify these modules for future projects (although the chance to reuse them is not slim anymore :))
Which option is more understandable Is it? If there's a better way I'd love to hear it.
Thank you!
I will move them to my own assembly / classroom library and create a repository based on "set" . Make a repository and data contantex for all purposes, for meaning, a purpose (i.e. posts, comments, tags, etc.).
What this should do to each datacontext, will help to isolate it and minimize the tracking which is behind datacontax curtain.
Besides, I'm not sure what you mean, "But I can load some of the DAL tables for some unnecessary inquiry and some modules." If you monitor the SQL that Linq is generating, you can tune your questions very easily. Make public methods in your repository, which only returns the appropriate number of records from the appropriate table. You'll be surprised how you can minimize "unnecessary queries" to SQL with SQL.
Comments
Post a Comment