Primary Key for Views


Author
Message
Chris Crabtree
Chris Crabtree
StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)StrataFrame User (157 reputation)
Group: Forum Members
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...Smile

Thanks!

Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.
Flavelle Ballem
Flavelle Ballem
StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)
Group: Forum Members
Posts: 56, Visits: 126
I told you that I might be missing somethingBigGrin Thanks for clarifying that for me.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search