StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Can business object support more than one...Expand / Collapse
Author
Message
Posted 07/04/2006 7:35:06 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
Posts: 25, Visits: 46
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.
Post #1719
Posted 07/05/2006 9:18:56 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
If you create a view that selects the appropriate fields from the separate business objects, you can map a business object to that view.


www.bungie.net
Post #1725
Posted 07/06/2006 8:09:02 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
Posts: 25, Visits: 46
Do you mean:

     1. create a view that selects the appropriate fields from the separate business objects, or

     2. create a view that selects the appropriate fields from the separate tables?

Is it possible to  create a view that selects the appropriate fields from the separate business objects?

Post #1731
Posted 07/06/2006 8:51:58 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
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.


www.bungie.net
Post #1734
Posted 07/07/2006 4:59:46 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
Posts: 25, Visits: 46
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?
Post #1764
Posted 07/07/2006 9:11:05 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
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.


www.bungie.net
Post #1766
Posted 07/08/2006 12:23:16 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
Posts: 25, Visits: 46
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

BusinessLayerException
 An error occurred while saving an the data to the server.
DataLayerSavingException
 Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.
DataLayerException
 Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at MicroFour.StrataFrame.Data.DataLayer.BuildInsertInfo(DataTable UpdatingTable, Boolean Transactional, String TransactionKey)

.

.

.

I manually assigned one of the fields from the view to be the primary key. I changed the code in Business Object, Private Shared _PrimaryKeyFields As String() = New String() {""} to Private Shared _PrimaryKeyFields As String() = New String() {"customerId"}.

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?

Post #1773
Posted 07/08/2006 11:28:27 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
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.


www.bungie.net
Post #1779
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:54pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.141. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.