Getting DataRow from PersonEntity

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 03-Jan-2007 06:55:54   

Version 2, C#, VS.NET 2005, SelfServicing

I have a **BindingSource **whose **DataSource **is a PersonCollection.

When I ask for the **BindingSource.Current **the type is **PersonEntity **correctly.

How can I get a generic **DataRow **from the BindingSource.Current when it's an Entity?

Ian

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Jan-2007 08:26:19   

The Current property of the bindingSource returns an object representing the current item, so if you bind to an entityCollection, the current item would be of a EntityBase type (PersonEntity), and if you bind to a dataTable the current item would be a dataRow.

So maybe you need to either use the EntityBase type as your general returned type, or you may need to bind to a dataTable, by either fetching a TypedList / dynamicList, or projecting the EntityCollection's DefaultView to a datatable.