I am adding functionality to the website which works lengthy-running processes asynchronously using MSMQ. Carrying this out ansynch, however means we have to inform customers when their demands are completed. While using command pattern, I produced an interface* known as INotify and composed that in to the message class, therefore the message processing class can easily call GiveNotice() around the message's INotify object. The very first implementation, EmailNotify, was harder than expected, when i was surprised to uncover MailMessage is not serializable, but first got it going.
Now I am focusing on a brand new concrete notifier, DBNotify, that will call a SP of some kind increase a standing within the primary transactional database. I am tripped up for the reason that I must reuse the DAL architecture we have already produced, but INotify is part of the Model project, that is more fundamental compared to DAL.
Our hierarchy appears like this: Common > Model > DAL > BAL
Here's more detail concerning the tiers. Keep in mind, I inherited this from : Common accounts for all "utility" functions that are used a multitude of locations within the application, such things as being able to access configuration configurations, parsing strings, non-business related functionality.
Model are business objects, what some people call bandwith objects, collections of getters and setters. I have added some "inteligence" only at that layer, only business rules internal to that particular object, for example "An item's title must start with an alphanumeric character."
DAL may be the data access layer, theoretically, everything happens here's model objects are moved into and from the database.
BAL may be the Business layer theoretically, business rules that govern the interaction of objects are enforced (i.e. "An application should have a minimum of two products.").
Therefore the INotify interface is determined an abstraction to permit the technique of notification to alter individually (i.e. email, TXT, twitter, etc). It's fundamental somewhere, and so i have produced it in the Model tier, that is in addition to the DAL tier. However, I'm developing a new concrete implementation of INotify whose notification technique is to call a SP inside a database.
Has other people worked having a business object whose purpose would be to communicate with a database, and just how would you situate that inside your N-tier architecture?
Before you decide to let me know to make use of Linq to Sql, great thanks. This isn't a technical question (how do you do that), it is a design question (how must i do that).
I believe there's a StackExchange site focused on these kinds of language-independant design questions, so I am likely to copy this there.