vendredi 30 janvier 2015

need to call provider to provider, but i wont

I've been refactoring a project so we get some proper architecture, though I've run into a problem which i can't seem to figure out without "hacking" the design pattern. Intro: presentation : contains my aspx files and ashx files, and only calls the next layer. Business logic : Contains Providers, which are used by presentation layer, and calls the data layer. data layer : Contains Collections of the entities and are called by the business logic layer. And has the connection to the database.


So pretty standard.


I have a OrderProvider method that should return a Order based on a orderId from the presentation layer, but that order also needs to have its ProductBundleLines And subscriptions on the productBundleLines. So a Order contains a list of productBundleLines which then contains a subscription object.


Normally when i want to get the productBundleLines i use the ProductBundleProvider, and the ProductbundleProvider has a method that fits my need to retrieve the productBundleLines with subscriptions PERFECTLY. But as i know of the pattern, this isn't allowed. Im not allowed to call a provider from another provider.


It would just be silly if i had the same code now in the orderProvider, though it would solve the problem. Or is there any other way that this could be made ?


ive sketched the setup in a uml, which would give a better overview of the structure. And just forget about the Managers, those arn't relevant in this case :) UML link


Hopefully this makes sense for you guys!


Aucun commentaire:

Enregistrer un commentaire