Posted by david on 10. December 2008 12:12
I think I’ve found the answer to my earlier data object questions.
k –
I’ve got a map, which has layers, which has shapes
the map & the layers are, themselves, data containers. If my question is: what shapes are on the map, I can query the Map object, Map.GetShapeLayerCount … iterate through the map, getting the layers, then iterate through the layers, getting the shapes.
It seemed cumbersome to me. Further, what if I want to provide controls that are bound to the set of layers or the set of shapes … Well, would I then be doing the above iteration every time? Then how to move things around?
Now, eventually, the map would be attached to a db .. with the user provided locations … but it would take a lot of users to make for an interesting map .. so I’ll have to be using other data sources …
The map is the presentation data container for an array (npi) of data sources. Further, the user could be adding points to the map, not immediately represented in the data source of the layer their adding to.
When G goes to the bead store, she walks around the bead store with a tray. She picks out beads from the bagillion different containers of beads in the store, then uses that tray of beads for her final work. I’m reaching a little, but the map is the tray. The datasources are the bead bins. If she could materialize new beads out of thin air, the metaphor would be a little more perfect … because the user can add shapes to the map, with relevant data, and upload the newly defined shape to whatever datasource they have permissions to.
If the map topic was Seattle sightseeing spots, one datasource might be a public db, or two … ( merged, say hiking sites & coffee sites ) … plus add in a spot that a friend told ‘em about. Then the work is finished. We can take that new set of points & save it to the user owned datatank.
My earlier problem was figuring out how to bind the controls, for layer selection & shape selection to the map. Plus it needs to be super easy to drop a point, or edit a point.
I could run a temp table in the sites SQL DB, but that would still involve frequent trips back to the server. What I need is an in memory data object.
I reviewed collections earlier … & those worked ok … I need, however, tables. Admittedly. my programming skillz are weak & I can’t see a way to do it using self defined objects.
But, now I do – & the clincher is that I get to use tables, just in memory tables:"
( Source: Esposito, Dino. "Chapter 8 - ADO.NET Data Containers". Programming Microsoft ASP.NET 3.5. Microsoft Press. © 2008. Books24x7. <http://common.books24x7.com/book/id_24532/book.asp> (accessed December 10, 2008) )
“ The System.Data namespace contains several collection-like objects that, combined, provide an in-memory representation of the DBMS relational programming model. The DataSet class looks like a catalog, whereas the DataTable maps to an individual table. The DataRelation class represents a relationship between tables, and the DataView creates a filtered view of a table's data. In addition, the System.Data namespace also supports constraints and a relatively simple model of indexing.
The DataTable object represents one table of in-memory data. Mostly used as a container of data within a DataSet, the DataTable object is also valid as a stand-alone object that contains tabular data. The DataTable and DataSet are the only ADO.NET objects that can be remoted and serialized. Just as with a DataSet, a DataTable can be created programmatically. In this case, you first define its schema and then add new rows. The following code snippet shows how to create a new table within a DataSet:
DataSet ds = new DataSet();DataTable tableEmp = new DataTable("Employees");tableEmp.Columns.Add("ID", typeof(int));tableEmp.Columns.Add("Name", typeof(string));ds.Tables.Add(tableEmp);
The table is named Employees and features two columns—ID and Name. The table is empty because no rows have been added yet. To add rows, you first create a new row object by using the NewRow method:
DataRow row = tableEmp.NewRow();row["ID"] = 1;row["Name"] = "Joe Users";tableEmp.Rows.Add(row);
“
Woot !