Information générale
Catégorie:
The Mere Mortals .NET Framework
>Steve,
>
>>I would like to be able to set up a "Generic" bizobj that I can use on a "Generic" lookup table maintenance web form. Unless there is a really good reason to, I'd rather set this up generically rather than creating a bizobj/webform for every lookup table - since nearly all of them have the same structure. Actually, I have started attempting to build this, but ran into some problems when changing the table within the UI. I decided it might be better to post the idea to see if this appears to be something that is possible within the framework and if this is a valid approach.
>
>It is conceivable to do something like this. You should be able to instantiate the generic business object, set its properties such as TableName, PrimaryKey, and SELECT statement. What problems were you running into trying to do this?
>
>Regards,
So far, what I've done is created a bizobj that has an override of the constructor that accepts a tablename and thus sets that property. It then queries the SQL Server schema to determine the primary key and sets that property. It has a generic getAll method that constructs the SELECT statement and returns a dataset with all records for the specified table.
I have created a web form (mmBusinessWebPage) with a dropdown list for selecting the table to be maintained and an mmDataGrid with its BindingSource set to the generic bizobj class name (Lookup). The SelectedIndexChanged event handler for the dropdown list gets the selected table name, calls the RegisterBizObj(new Lookup(tableName)), calls the getAll method, sets the mmDataGrid BindingSource & BindingMember properties, and then calls the form's BindControl with the name of the datagrid.
I'm currently having trouble with the datagrid button column event handlers (Edit, Update, Cancel, Delete), so I need to get that resolved before I will know what the issues are with the form handling of the generic bizobj.
Thanks for the response - I mainly needed to know if this was even a worthwhile approach before spending a lot of time with it.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement