﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum / StrataFrame Application Framework / Business Objects and Data Access (How do I?)  / Can business object support more than one table? / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Tue, 02 Dec 2008 10:23:09 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>As long as the view is an indexed view on SQL Server, allowing you to INSERT, UPDATE, and DELETE records from it, then what you have done is fine.  You might even be able to define a primary key index on the view within SQL Server, allowing you to avoid having to change that code each some you rebuild the partial class within SQL Server.</description><pubDate>Sat, 08 Jul 2006 23:28:27 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>I created a business object and mapped it to a view. When I tried to add record, an error occured. The error message as below &lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;BusinessLayerException&lt;BR&gt; An error occurred while saving an the data to the server.&lt;BR&gt;DataLayerSavingException&lt;BR&gt; Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.&lt;BR&gt;DataLayerException&lt;BR&gt; Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;Source     : MicroFour StrataFrame Business&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;Stack Trace: &lt;BR&gt;   at MicroFour.StrataFrame.Data.DataLayer.BuildInsertInfo(DataTable UpdatingTable, Boolean Transactional, String TransactionKey)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111 size=1&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I manually assigned one of the fields from the view to be the primary key. I changed the code in Business Object, &lt;FONT color=#008000&gt;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Shared&lt;/FONT&gt;&lt;FONT color=#000000&gt; _PrimaryKeyFields &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;() = &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;() {&lt;/FONT&gt;&lt;FONT color=#800000&gt;""&lt;/FONT&gt;&lt;FONT color=#000000&gt;} &lt;/FONT&gt;&lt;FONT color=#1f5080&gt;to &lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Shared&lt;/FONT&gt;&lt;FONT color=#000000&gt; _PrimaryKeyFields &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;() = &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;() {&lt;/FONT&gt;&lt;FONT color=#800000&gt;"customerId"&lt;/FONT&gt;&lt;FONT color=#000000&gt;}. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&lt;FONT color=#1f5080&gt;&lt;FONT color=#1f5080&gt;After that I can add and update the records using that business object. Is this the correct way to do it? Will it cause any problem?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Sat, 08 Jul 2006 12:23:16 GMT</pubDate><dc:creator>Wang Tong Yin</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>The business objects will not prevent a user from being able to add new records, remove records or modify records if it is mapped to a view.  The best way to prevent the user modifying the business object would be to handle either the BeforeDelete and BeforeAddNew events and set e.Cancel = True.  Or you could handle the CheckSecurity event and deny the action.</description><pubDate>Fri, 07 Jul 2006 09:11:05 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>After I create a view within the database that selects its fields from the separate tables,  I will create a business object that will map to the columns of the view.  Some fields of the view are table's primary key, index key or candidate key. Will the business object automatically trap the error when user try to add, edit or delete record? If the business object can trap the error, where can I know the error occur? Is the Business Object return any message or raise any event?</description><pubDate>Fri, 07 Jul 2006 04:59:46 GMT</pubDate><dc:creator>Wang Tong Yin</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>I mean to create a view within the database that selects its fields from the separate tables.  You can then create a business object that will map to the columns of the view.  In answer to question #2, you cannot create a business object that can select fields from multiple business objects.  You would need to create a wrapper by hand that held the separate business objects.</description><pubDate>Thu, 06 Jul 2006 08:51:58 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>Do you mean:&lt;/P&gt;&lt;P&gt;     1. create a view that selects the appropriate fields from the separate business objects, or &lt;/P&gt;&lt;P&gt;     2. create a view that selects the appropriate fields from the separate tables?&lt;/P&gt;&lt;P&gt;Is it possible to  create a view that selects the appropriate fields from the separate business objects?</description><pubDate>Thu, 06 Jul 2006 08:09:02 GMT</pubDate><dc:creator>Wang Tong Yin</dc:creator></item><item><title>RE: Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>If you create a view that selects the appropriate fields from the separate business objects, you can map a business object to that view.</description><pubDate>Wed, 05 Jul 2006 09:18:56 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>Can business object support more than one table?</title><link>http://forum.strataframe.net/Topic1719-6-1.aspx</link><description>I tried to use Business Object Mapper to map the table to a business object. I found that I only can select one table. Is it possible that business object can work with more than one tables? For example, a business object can select the fields from three tables.</description><pubDate>Tue, 04 Jul 2006 07:35:06 GMT</pubDate><dc:creator>Wang Tong Yin</dc:creator></item></channel></rss>