开发者

XML via database

开发者 https://www.devze.com 2023-02-13 14:13 出处:网络
I have a list of strings,the list is constant and won\'t be changed, there are 12 strings. Inside database table I have a column with an index to the string.

I have a list of strings,the list is constant and won't be changed, there are 12 strings.

Inside database table I have a column with an index to the string.

I don't think it's wise to hold a separate table to hold those strings because they never get changed neithe开发者_开发知识库r to save the string it self inside this column.

So the only option is to hold the list in some other type.

What about holding the strings in XML file and using Linq-to-Xml to load them into dictionary. If so is thi better, performance wise, then using datatable?


Those strings will most likely get cached by your SQL server and apply almost no performance hit. But will give you a flexibility in case you have multiple applications sharing same database. Overall keep those in the database unless you have/expect millions database hits.


I agree with Zepplock, keep the strings in the database. You won´t have to worry about performance. One of the big reason is also that if you do so, it will easier for future developers to find the strings and understand their function within the application if you store them in the database in their proper context.


It sounds as if you're describing a table holding product catalog data. Suggest keeping those values in their own rows, and not stored as an XML datatype or in XML in a varchar column.

It sounds as if the data is static today, and rarely if ever, is changed. By storing in XML, you lose the potential future advantage of the relational nature of the database.

Suggest keeping them in a table. As you say, it's only 12 strings/products, and the performance hit will be zero.

0

精彩评论

暂无评论...
验证码 换一张
取 消