StrataFrame Forum

How to create a BO for a SQL View

http://forum.strataframe.net/Topic15781.aspx

By Aaron Young - 4/20/2008

I would like to create a BO for a SQL View which will be bound to an UltraGrid via a Business Binding Source. So far, I have created all my BOs and configured them through the Database Deployment Toolkit. However, it looks like I can only do this for tables and not views.

I have created a BO manually and inserted the SQL statement to query the view. However, when I add a BBS for the BO and bind it to my UltraGrid, no column information is displayed in the grid. The BO is not passing schema information to the grid at design time.

1. Is there an easier way of creating a BO for a SQL View rather than manually creating the entire BO?

2. How do I tell the BO to give the correct schema information to the UltraGrid at design time?

Thanks in advance.

By Trent L. Taylor - 4/20/2008

Is there an easier way of creating a BO for a SQL View rather than manually creating the entire BO?

Yup...pull the schema from the SQL Server directly instead of trying to use the DDT.  The DDT does allow you to create and deploy views, but instead of totally rewriting the logic behind SQL server parsing and retrieving the columns of the view, we thought it much easier to just pull a view schema from SQL Server.  So on a BO that you intend to use as a view, choose the SQL Server option instead of the DDT (be sure to set the configuration properties for the SQL Server in the project properties), choose the view, and you are good to go.

How do I tell the BO to give the correct schema information to the UltraGrid at design time?

Well, in this case I am sure that you do not have all of your properties created like the BO mapper would, thus they don't show up.  If you map like I mentioned above the columns will show up.  But if you want to do it manually in the future for a custom property, then you will need to create a custom property, add the associated attributes, and it will appear.  There are a ton of posts and docs concerning creating a custom property.  But that would be what happened in this case.

By Aaron Young - 4/21/2008

Excellent! Will give it a try later.

Thanks.