如何设计XML文件存储库的体系结构 [英] How to design architecture for XML file repositories

查看:89
本文介绍了如何设计XML文件存储库的体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个数据来自xml文件的项目。我们也在xml文件中插入和更新数据。获取连接多个xml文件的数据。现在使用数据集读取xml函数从xml文件加载数据。讨论如何为xml文件数据读取/插入/更新开发一个小型的好架构



我找到了一些链接


https://stackoverflow.com/questions/4819680/xml-repository-implementation

https://www.codeproject.com/Articles/1119652/Repository-Pattern-For -Net

https://codereview.stackexchange.com/a/122910


谢谢

解决方案

你没有要求提供设计建议,但这不会阻止我。 免费建议值得您为它支付的每一分钱。


XML是在不同系统上不同标准的玩家之间交换信息的好方法。 但是,它不是数据存储的良好基础。 搜索非常昂贵,插入和更新既昂贵又危险。 
请记住,您无法就地更新XML文件。 您必须读取文件,更新内存中的树,然后将文件写回。 这意味着在很长一段时间内你很容易受到冲突的影响。 你如何处理多个应用程序? 
如果应用程序A读取文件,然后应用程序B读取文件,然后应用程序A将其写回,然后应用程序B将其写回来,该怎么办? 应用程序A的更改将丢失。


我建议的是一个真正的数据库。 有很多很好的选择,有许多不同的设计目标。  MySQL或PostgreSQL是完整的客户端/服务器解决方案,具有完整的查询功能,事务保护和优秀的语言
支持。 今天,SQLite支持内置于多种语言中。 如果您的数据不能完全适合SQL模型,那么像MongoDB或CouchDB这样的NoSQL解决方案之一允许您将相对自由格式的数据存储为JSON文档,但是使用事务和
完整查询支持。


i am working with a project where data comes from xml files. we also insert and update data in xml file too. fetch data joining multiple xml file. right now load data from xml file using dataset read xml function. discuss how to develop a small good architecture for xml file data read/ insert / update ?

i found few links

https://stackoverflow.com/questions/4819680/xml-repository-implementation
https://www.codeproject.com/Articles/1119652/Repository-Pattern-For-Net
https://codereview.stackexchange.com/a/122910

thanks

解决方案

You didn't ask for design advice, but that isn't going to stop me.  Free advice is worth every cent you paid for it.

XML is a great way to exchange information between players on different systems with different standards.  However, it is not a very good basis for a data store.  It's very expensive to search, and it is expensive and dangerous to insert and update.  Remember, you can't update an XML file in place.  You have to read the file, update the tree in memory, and write the file back out.  That means there is a huge period in which you are vulnerable to conflicts.  How do you handle multiple applications?  What if app A reads the file, then app B reads the file, then app A writes it back out, then app B writes it back out?  App A's changes are lost.

What I suggest instead is a real database.  There are lots of excellent choices, with many different design goals.  MySQL or PostgreSQL are full client/server solutions, with full query abilities, transaction protection, and excellent language support.  SQLite support is built-in to many languages today.  If your data does not neatly fit the SQL model, one of the NoSQL solutions like MongoDB or CouchDB lets you store relatively free-form data as JSON documents, but with transactions and full query support.


这篇关于如何设计XML文件存储库的体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆