Thursday, March 08, 2007

I have been working recently quite extensively on ADO.NET and using data bindings. As we know ADO.NET work very well with DataSets and custom classes to create the entities to represent the data objects. We have decided to use custom classes for our application. We are using object data sources since we have created class entities. I got this piece of code from MSDN which shows a very nice way of using DataBinding. As we can see it is very easy to use and let me tell you from personal experience it is fast as well than using a normal dataset or xml for accessing data.

private void SetupBindings()
{
BindingList orderList =
new BindingList(Order.GetEntityList());
orderBindingSource.DataSource = orderList;
BindingList customerList =
new BindingList(Customer.GetEntityList());
customerBindingSource.DataSource = customerList;
BindingList empList =
new BindingList(Employee.GetEntityList());
employeeBindingSource.DataSource = empList;

}

Thus i reckon .NET winforms provide great support for databindings and it is one of the best options to use.