Building on my last post about the MsSql2008FeatureLayer, I’ve now been experimenting with saving entire objects to the database so that I can later deserialize them into memory and work with them and their associated features. The classes I am trying to save are abstract, so I can’t just create fields in the db for each value.
One of the limitations to this seems to be that you have to save strings to the MsSql2008FeatureLayer fields. As such, I found the following code snipits that will do the job of converting byte to string and vice versa.
In my test project, I have a test for this to ensure read after write is performing correctly when working with just the string values and not the database.
However, when running the same code to read from a record written on the database, the process fails. I can only assume it is something to do with the feature layer, the db field type, the encoding or some combination of the three.
I’ve attached my simple test project. You can create a db that replicates my test, add a feature to the db and then try to display it back. You can also verify my static read after write process. You just need to modify some of the conn properties for your default SQL db locations and instance.
Let me know if you can help on this.
DatabaseToMap.zip (56.4 KB)