Note that there are some explanatory texts on larger screens.

plurals
  1. PON-Tier Design for Common Business Tier but Different Presentation and Data Tiers
    primarykey
    data
    text
    <p>I have an application that exists in 3 different presentation tiers...web, mobile (offline) and desktop (offline). The core business objects are the same for all three, and they share the same validation and business rules. However, they all use different databases (web - SQL Server 2008, mobile/desktop - SQL Compact). Through a synchronization process, the desktop and mobile apps push and receive data from the server's SQL 2008 db.</p> <p>I'm trying to come up with the best n-tier approach and I'm a little stuck. I've created an assembly for my business objects that encapsulates all of the business rules. I would very much like each object in this assembly to have a Save() method. However, I don't want this layer to be aware of any specific data layer. Basically, I want all three presentation layers to populate these objects and call the Save() method. But I want the implementation of the Save() method to be different depending on the calling application.</p> <p>I initially created an interface called IDataAdapter and then a static property on each object for the IDataAdapter. Then the Save() method just checked if this was set, and then pass the business object to it's Save() method.</p> <pre><code>public interface IDataAdapter { void Save(BusinessProxy proxy); } public class BusinessProxy { public IDataAdapter myAdapter { get; set; } public bool Save() { if (myAdapter == null) throw new Exception(); myAdapter.Save(this); } } </code></pre> <p>Of course, this isn't ideal because the presentation layer would need to have a reference to the data tier in order to set the Adapter property. I would really love to have some sort of plugin system where I could just swap out the data.dll depending on the app platform.</p> <p>Does anybody have any suggestions on how to implement this a little better?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload