C#: How would you store arbitrary objects in an SQL Server?

前端 未结 3 1861
挽巷
挽巷 2021-01-06 19:05

Lets say you have various objects of arbitrary type that you would like to store in a key+value type of table. Key could for example be an int, string or guid. What would th

3条回答
  •  一生所求
    2021-01-06 19:36

    When we have done this type of thing we have kept the data in a byte array while in C#, and stored it in a varbinary(max) column in SQL Server.

    EDIT Based on comment

    You could try having a property on your class that was the byte array of your value field.

提交回复
热议问题