Move data layer into separate assembly

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
Guys,

What you think about to move NopCommerce data layer into reusable separated assembly?

I think, the question no.1 for most of NopCommerce users is a most efficient way to automate NopCommerce database administration.

I working on development of some kind of BackOffice application which automates such operations as update of product desctriptions, prices and etc. directly from Excel or other Storehouse management systems and faced the problem that reuse of existing NopCommerce data-layer (NopObjectContext, ProductManager and so on) is possible but not so straightforward:

1. I should reference the Nop.Common and Nop.BusinessLogic assembly to access Entity Model (which contains a lot of web-application specific code)
2. I should create data context using following hack:

NopConfig.ConnectionString = ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString;
var context = ObjectContextHelper.CurrentObjectContext;

3. Usage of Managers is possible but not efficient use because each call of a manager's method causes instantiation of a new instance of DataContext (bacause HttpContext is null for Desktop application) and so on.

I suggest to:

Move whole data-layer (DataContext, data-related Managers, data validators etc...) into separate reusable assembly.


P.S. Thank you for your work!
13 лет назад
Based on discussions regarding a new caching layer for the storefront I am hoping that we return to a more logically tireed solution again:

1) Storefront
2) Service Layer
3) Data Access Layer (Entity Framework)
13 лет назад
Agree. Have been hitting similar gotchas myself. The DAL needs to be decoupled from the web front end. Using it in other apps (and in LinqPad) is harder than it ought to be.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.