简体   繁体   English

如何存储结束编辑我的配置文件

[英]How to store end edit my configuration file

I have an application (split in different websites that share the same data) that contains thousands of products in different categories. 我有一个应用程序(分布在共享相同数据的不同网站中),其中包含数千个不同类别的产品。 Every category has its features, and to describe them I have used an XML file, embedded in a class library. 每个类别都有其功能,为了描述它们,我使用了嵌入在类库中的XML文件。 Its format is like that: 其格式如下:

<category code="" name="">
<featureGroup code="" name="">
<feature code="" name="">
<feature code="" name="">
<feature code="" name="">
</featureGroup>
</category>

This is overly simplified, my real files are much more complicated than that. 这过于简化了,我的真实文件要复杂得多。 The problem with this approach is that I have to recompile every time I have to make a change and redistribute my library to every different website. 这种方法的问题在于,每次必须进行更改时,我都必须重新编译,然后将库重新分发到每个不同的网站。

So I made the file a standalone XML file, but also with this approach I have to redistribute the file every time I make a change. 因此,我将文件制作为独立的XML文件,但是使用这种方法时,每次进行更改时,我都必须重新分发文件。

So I converted my XML file in many tables and store these informations in a Sql database, but this approach has many disadvantages: it's far less flexible because if I make a change in the structure of the file I also have to change tables, relationships, stored procedures, etc... another problem is that XML works well with sorting. 因此,我将XML文件转换为许多表并将这些信息存储在Sql数据库中,但是这种方法有很多缺点:灵活性较差,因为如果我更改文件的结构,还必须更改表,关系,存储过程,等等。另一个问题是XML可以很好地进行排序。 If I want to change the order of my features I just have to cut and paste a line in a different positions, if I try to do the same in my database I have to add a Position column and then provide some tool to reorder items and that's really a great mess. 如果要更改功能的顺序,只需在不同位置剪切和粘贴一条线,如果尝试在数据库中执行相同的操作,则必须添加“位置”列,然后提供一些工具来对项目进行重新排序,真是一团糟。

I don't know how to solve this problems, I really like the flexibility of XML, I like the possibility of accessing my database anywhere from every web site, but I can't find a way to merge these two approaches. 我不知道如何解决这个问题,我真的很喜欢XML的灵活性,我喜欢从每个网站的任何地方访问我的数据库的可能性,但是我找不到融合这两种方法的方法。

Thank you very much and sorry for my rusty english! 非常感谢您,我的英语不好!

Create a small web service (which is accessible like your database) and make it serve the contents of one centrally stored xml file. 创建一个小型Web服务(可以像访问数据库一样访问它),并使其服务 一个集中存储的 xml文件的内容。 Ie it should have one single request which answers with your xml file. 即,它应该只有一个请求,该请求可以回答您的xml文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM