In a n-tier architecture, the interface part must rely only on the business layer to get it's data. The interface layer cannot access the datasession of the business layer, it run on a different process.
There are many ways of transferring data between a business object and the interface.
For one record, you can:
- Pass an object containing one property for each field
- Create a property/method for each field in the business object that the interface can query
- etc.
For many records, you can:
- Pass a recordset via ADO
- Use XML
- etc.
The business layer can use any available methods to access the database, but a view is preferable, since it will be easier to switch the database layer that way (SQL Server, Oracle, etc.)
Take a look at this web page for more information about n-tiers design:
http://jamesbooth.com/n-tier.htmHTH
>I'm creating my first app using a 3-tiered architecture. It's great, but I feel like I'm missing some key elements.
>
>For example, in my interface tier, I have a list box. How would one populate that with data? My first thought was to have the business object query the data object for an array, but then I thought - I'm using VFP, I feel like I should be using views. If only there was some way to pass object references to views in other datasessions (is there?).
>
>My next idea was to create a method in my data object which would actually open the view in the datasession of the form containing the list box. The business tier would tell the data tier which datasession and alias to use, but I hate jumping around data sessions (perhaps an unfounded fear?).
>
>I feel like there are some key concepts I'm missing. Any suggestions?
>
>Also, any suggestions as to good books or articles? I've read both Effective Techniques (Booth and Sawyer) and Advanced OOP for VFP6 (Egger) - both incredible books which catapulted my skills, but neither book is geared strictly towards 3-tier design (though both have solid introductions).