I’m working on a project where we have a pre-existing DataSet. We don’t do any persistence type stuff. It just acts as a holder for data we read in from DB2.
I need to add a new column to one of the tables. I can open the designer and see the DataTable… I could manually add the column of course, but I was wondering if there’s a way to tell Visual Studio to go get the table schema from DB2 and build the DataTable for me? It’d be pretty cool if that would also handle easily updating it with schema changes in the future. I’d want my DataTable/DataSet to be strongly-typed, which is something have right now with manually adding columns in the designer.
I haven’t had much luck finding any tutorials. An intermediate solution might be to generate XSD from the DB2 schema and import that, but considering my lack of knowledge in this area, I thought it’d be good to get some input from others.
There are many ways to do this.. a search on POCO (Plain Old CLR Object) should return you many happy results. (NB, this is a “joke” on the term POJO).
Of course this is stackoverflow.com so you could use the one they wrote… it is at:
http://code.google.com/p/dapper-dot-net/
I don’t recommend EF, it is a little heavy for a quick-n-easy solution.
Good luck.