S
Stephan Elsner
I am developing a time recording application that uses several lists
of data (customers, projects etc). There is not much data, it can be
held in memory and there is no need for mobile sql server. The lists
act like relational database tables and they shoul be exported as one
xml document. Now my questions:
1. My first idea was to create objects like Customers etc. and store
them in a BindingList<> to easily bind the list to a DataGrid for
display. I found out that XmlSerializer throws an exception
" ...DataList is inaccessible due to its protection level". DataList
is a class derrived from BindingList with one additional method:
class DataList<T> : System.ComponentModel.BindingList<T> where
T : DataSet
{
public T getSet(int id)
{
foreach (DataSet ds in this)
{
if (ds.Id == id)
{
return (T) ds;
}
}
return null;
}
public DataList() { }
}
"DataSet" in this case is my own DataSet whis is a base class for all
Classes containing one Row of Data (in german "Datensatz"). Dont mix
up with the ADO DataSet. No Idea why this exception occurs.
2. Is this a usable design at all? Or is it better to greate a virtual
database structure in a DataSet object? Ok, it would be easyer to
serialize (create xml) and deserialize later, but I need an oo
wrapper then, so there is much more to code...
Hou would you solve this problem?
Thanks for any hints
/Stephan
of data (customers, projects etc). There is not much data, it can be
held in memory and there is no need for mobile sql server. The lists
act like relational database tables and they shoul be exported as one
xml document. Now my questions:
1. My first idea was to create objects like Customers etc. and store
them in a BindingList<> to easily bind the list to a DataGrid for
display. I found out that XmlSerializer throws an exception
" ...DataList is inaccessible due to its protection level". DataList
is a class derrived from BindingList with one additional method:
class DataList<T> : System.ComponentModel.BindingList<T> where
T : DataSet
{
public T getSet(int id)
{
foreach (DataSet ds in this)
{
if (ds.Id == id)
{
return (T) ds;
}
}
return null;
}
public DataList() { }
}
"DataSet" in this case is my own DataSet whis is a base class for all
Classes containing one Row of Data (in german "Datensatz"). Dont mix
up with the ADO DataSet. No Idea why this exception occurs.
2. Is this a usable design at all? Or is it better to greate a virtual
database structure in a DataSet object? Ok, it would be easyer to
serialize (create xml) and deserialize later, but I need an oo
wrapper then, so there is much more to code...
Hou would you solve this problem?
Thanks for any hints
/Stephan