Serializing Config Section
I have a custom config section that i have built, and i am attempting to serialize it. My plan is to store the serialized section in SQL as a text column for retrieval later. What is the best way to accomplish this?
16 Replies
Depends on the database
In Postgres, I'd just use a Json column
im using SQL, the part im struggling with (my fault i didnt explain) is the actual serialization of the config
MySQL? MariaDB? SQLite? MSSQL? PostgreSQL?
MSSQL on Azure
It supports Json columns, so just use that
Assuming you use EF for the ORM, it should be super simple
yeah using EFCore
heres the tricky part, the config is on a remote device and is sent as a the body of a service bus message
Right, what is the config here?
A plain text file? A structured JSON? XML? A binary file?
xml, a custom section i wrote
Ah, then probably not a json column
Just store it as text IMO
inherits from ConfigurationSection, which is supposed to have an XML serializer that i have not been able to make work
I don't think there are any databases with XML columns... but if there ever was one, it would be Microsoft's
But yeah, far as I can tell, just stuff it into a
TEXT
columni think you can just use text and store the xml as a json string
then deserialize with Jsonconvert and be good
im just having issues getting the config section to serialize
You mean XML -> JSON -> save in JSON column?
yeah
Sure, that could work
If you don't need to query it, I think plain text would still be fine tho
nope no query needed, just need to pull that column, let Ef turn it back into the object then throw it into a message body and send it
all the props i need to query are their own columns in SQL