CSLA Dynamic Database Business Object

CSLA Dynamic Database Business Object

Old forum URL: forums.lhotka.net/forums/t/2357.aspx


gdk9am posted on Thursday, February 15, 2007

My application design calls for a dynamic table and field layout.

It is requirement of my application,  to store the user defined fields in the exisiting table rather than a child table.

Therefore I am creating a dynamic business object which will handle CRUD operations through dynamic SQL.

I have implemented the ICustomTypeDescriptor interface in this object. However the dictionary which contains the property name, property type, and property  value are stored in the object. This seems to cause a problem when the table is empty as manually emunerating through the property descriptor collection so that I manually add the columns to the xceed grid.

Rocky suggested the following method using ITypeDescriptor. However I cannot find ITypeDescriptor in .NETdocumentation.

There are two basic answers: use a dataset or implement ITypeDescriptor.

The DataSet approach would involve building a business object that contains a single field: the dataset. That field is exposed through a read-only property and the UI connects to it directly. It isn’t my favorite approach, but it certainly can work.

The ITypeDescriptor approach is a bit more work, but can get better results. This interface allows you to dynamically describe the shape of your object at runtime. Using it, you don’t implement any properties on your object at all, but instead just implement this interface and let data binding dynamically find the shape of your object and get the values from you. This allows you to store the values in a Dicationary or something like that inside your object.

Could anyone explain how data binding dynamically finds the shape of your object ?

I am using developing this application in New Zealand, would like to know any else in NZ has looked or developed a similar object.

 

.

RockfordLhotka replied on Friday, February 16, 2007

I meant ICustomTypeDescriptor, sorry. Embarrassed [:$]

Copyright (c) Marimer LLC