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



Primary Key for ViewsExpand / Collapse
Author
Message
Posted 09/27/2006 11:49:49 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 07/09/2007 2:48:58 PM
Posts: 57, Visits: 107
As previously mentioned on here, one of the improvements v1.5 brings is the ability to define a PK on a view. This allows us to define a BO made up of multiple related tables, particularly the base-type/derived-type idiom, all within the database using SQL Server 'instead of' triggers on the view.

In essense, SF should treat such a view just like it was a normal table. But to get referential integrity support, SF needs to be able to assign the view a PK.

So now that I've just installed v1.5, I am apparently missing where in the DDT I would do that. It must be so obvious that I'm just looking in the wrong place...

Thanks!

Post #3115
Posted 09/27/2006 12:30:45 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
Ah, the functionality was moved to the Business Object Mapper.  After you choose the view to which the business object gets its mapping information, you can go to the "advanced" options under the business object's properties and check the override primary key box, then click the "..." button and choose the fields that should be the primary key on the business object.


www.bungie.net
Post #3121
Posted 09/27/2006 12:53:13 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 07/09/2007 2:48:58 PM
Posts: 57, Visits: 107
Okay...but if I can't define the view's PK in DDT, how do I define the relationships the view will have with the other tables, etc.?
Post #3124
Posted 09/27/2006 1:18:58 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 6:26:12 PM
Posts: 4,901, Visits: 4,887
That is the nice thing about the framework.  You can define the relationships within the business objects themselves.  The relationships defined on the BOs do not have to actually exist on the server.
Post #3127
Posted 10/04/2006 4:50:51 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 03/20/2008 9:39:53 PM
Posts: 56, Visits: 126
Wouldn't referential integrity rules be required if the View was being used to insert or update values? I'm probably missing something.
Post #3272
Posted 10/04/2006 9:54:38 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
SQL Server 2005 will not let you define foreign keys from a view to other objects.  You can define indexes on a properly configured view, but not relationships and not primary keys, just regular indexes.  The PK definition within the BOMapper allows the BOMapper to specify the primary key when building the partial class for the business object.  This allows the business object to properly create the dynamic SQL at runtime that will be used to "insert" or "update" the view.  Without a primary key definition, an update from the BO to the database would fail because the WHERE clause of the update would not be able to specify only a single row.


www.bungie.net
Post #3284
Posted 10/04/2006 11:42:19 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 03/20/2008 9:39:53 PM
Posts: 56, Visits: 126
I told you that I might be missing something Thanks for clarifying that for me.
Post #3291
« 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:13pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 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.