Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Controls To Business Entity Properties
Message
 
À
05/02/2007 09:50:14
Duncan Mcdonald
Canadian Natural Resources Ltd
Calgary, Alberta, Canada
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 8.0
OS:
Windows 2000 SP4
Database:
Oracle
Divers
Thread ID:
01192388
Message ID:
01193090
Vues:
14
Duncan,

>I would like to find a way to bind controls to the Properties in the Business Entity instead of referencing the column names in the Dataset. For example, I currently have an mmListBox control with the BindingSource set to the "Company" Business Object, the BindingSourceDisplayMember set to "COMPANY_NAME", and BindingSourceValueMember set to "COMPANY_ID". I would like to have the Display and Value members set to the abstracted Business Entity Properties of "CompanyName" and "CompanyID", respectively, to avoid the direct dependency on my dataset. Any insight on how to achieve this in MM would be greatly appreciated. Thanks very much...

You can use standard VS 2005 data binding to accomplish this. You can add a new Data Source to the Data Source window (from the VS main menu, select Data | Add New Data Source. In the Data Source Configuration Wizard you can select Object, click Next. You can then select one of your entity objects, click Next, then click Finish. This adds your entity object to the Data Sources window.

Now you can drag and drop the entity object from the Data Sources window onto a Windows Form and it uses the new Windows Forms 2.0 data binding model. But, BEFORE doing this, you should change your Visual Studio settings so that it adds MM .NET user interface controls to your form rather than regular .NET controls. To do this, select Tools | Options from the VS menu and select Windows Forms Designer | Data UI Customization. You can then specify to use MM .NET UI controls by default for each data type.

By default when dragging and dropping your entity object from the Data Source window, VS adds a grid to your form. If you select to Details in the combo box for your entity object in the Data Source window it drops individual controls on your web form for each entity property. Afterwards, you still need to set the BindingSource property of your user interface control to the associated MM .NET business object so all the underlying MM .NET behavior kicks in.

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform