dgsoft
|
|
Group: StrataFrame Users
Posts: 93,
Visits: 236
|
Hi,
I have some view and want to use business object to provide access to this view (bind to grid, use as datasource and so on)
So,
I create view using DDT, then deploy it
Then I create new business object, start Business object mapper
Select business object
Click "Configure"
Then using "DDT" option in optiongroup - click "Select" - and there only tables are listed.
The question is:
How can I create business object based on view?
Thanks
Denis
|
|
|
Les Pinter
|
|
Group: Forum Members
Posts: 43,
Visits: 213
|
Hi Denis, If your view is located in a SQL Server database, use SQL Server instead of the DDT option, and you should see your view in the list of "tables" under your database node. Les
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Les is right on the money. When you want to pull a schema of a view for a BO, point it to SQL Server and select the view instead of the DDT. SQL Server will then do all of the parsing to give you all of the fields that are available. If you plan on doing updates on this BO, you will want to make sure that you use a BO Mapper override to supply the BO with a default primary key and be sure to make the view bindable to the schema (this is a check box in the DDT on the view).
|
|
|
dgsoft
|
|
Group: StrataFrame Users
Posts: 93,
Visits: 236
|
Les, Trent,
Thanks for help!
Denis
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
If you have all your business objects in their own assembly ( the way it is done in Strataflix) you will also find you will want a different assembly for business objects that are based on views.
I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Charles R Hankey (01/14/2010) I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly.Hi Charles, I am sorry, but you are wrong in that statement. Each BO can be setup to use any source to get the table schema, just select any BO and right click and choose "Properties" and there you can select any source supported, the same thing can be done at the BO Project level, but this is basically done to get the connection string and sort of the default source, but as you can see each BO can have different Source to read the schema.
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly. Charles, thanks for your comments. But I do want to point out that you can in fact have every BO in the entire project pull from an entirely different location. The project settings are defaults only. On each BO when mapped, you can elect to use the DDT, SQL, OLEDB, etc. You can even override the SQL Connection on a per BO basis to pull a schema from an entirely different server if you like.
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
Ok, I have to go back and look at this again. Greg and I hammered on this an came to the conclusion we needed a separate project for the views BOs but it was early in my SF career and I haven't looked at ti closely since. I don't doubt you're right but somehow we both missed how to do it. Glad be wrong about this one as I found it very non-intuitive and inconvenient and that is not a common feeling in learning strataframe.
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
I just figured out why we thought it wouldn't work. Originally set it up to use DDT then when we tried to configure an individual BO and selected sQl it complained there was no connection string. Obvious now that going back to the project level, temporarily changing to sql then setting the connection string and then setting it back to DDT lets you have DDT as the default and then configure some the views BOs to use the SQL view directly. Sorry for the stupid advice but at least I learned something from it. ( it is my learning style - get smart by saying dumb things )
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
LOL...nothing to worry about. Glad you got it figured out
|
|
|