c#web base应用程序中的复制数据 [英] replication data in c# web base application

查看:98
本文介绍了c#web base应用程序中的复制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的应用程序有两部分,一个版本在中央公司使用,一个版本在另一家公司使用

每天所有子公司应该发送他们的主要公司的数据,他们可以有所有报告,我也有基本的数据表



i需要最好的复制方式,我有一些方案,但我不确定,请帮助我


my application has two parts, a version uses in central company and a version uses in another company
every day all subcompanies should send their data for main company,and they can have reports all of them,also i have basic data tables

i need the best way for replication , i have some scenarios, but im not sure ,please help me

<br />
1. i dont know using sql replication is a good way or not<br />
<br />
2. i can create script of data and then send files<br />
<br />
3. i can create export statement in code behind







<big>Problems :</big><br />
<br />
1.speed <br />
2.how do i implement basic data tables that are unic?

推荐答案

首先,它可能取决于DBMS。您尚未指定使用的内容。

您写道,数据将从分支机构上传到主办公室。因此,我们假设没有数据发送回分支机构。甚至更少,您不需要在分支机构之间同步数据。因为在后面这种情况下你必须处理一个更复杂的任务。



你可以做你在帖子中提到的所有内容。我不能告诉你哪一个最合适,因为我看不到你的数据结构,也没有看到它的大小。而且你可以考虑更多的可能性。



我不明白你对独特数据表的疑问。分支机构将有不同的数据库架构?如果是这样,它涉及其他问题...



我不会将上传的数据包视为主办公室数据库中的行。首先,发送的数据必须与其自身保持一致。我可以考虑许多其他场景,但这里有一个非常简单的场景(你不必担心很多事情):

备份分支机构数据库(因为它是二进制,它可能比任何文本表示都小,压缩备份。上传压缩文件。在主办公室解压缩并将每个上载的备份恢复到专用于该分支机构的数据库。您有两种选择:使用SELECT INTO语句将数据从分支数据库复制到主数据库,或者使报表查询聚合来自所有分支数据库的数据。



如果您选择合并数据,那么通过使用两个字段的主键,使行唯一非常简单:原始的一个在分支级别是唯一的,而一个ID用于标识分支机构本身。通过这种方式,您可以随时查看哪些数据来自哪个分支机构。



祝您好运!
First of all, it could depend on the DBMS. You have not specified what you are using.
You wrote, that data will be uploaded from branch office to the main office. So let''s suppose there is no data sent back to the branches. And even less you don''t need to sync data between branch offices. Because in this later case you have to deal with a much more complicated task.

You can do all that you mentioned in your post. And I can''t tell you which of them will be most suitable, since I don''t see the structure of your data, nor it''s size. And there can be even more possibilities you could consider.

I don''t understand your question about the "unique data tables". The branches will have different database schema? If so, it involves other questions...

I would not think of the uploaded data packet as rows in a the main office database. First of all, the data sent has to be consistent on it''s own. I could think about many other scenarios, but here is a really simple one (you don''t have to worry about lots of things):
Make a backup of the branch office database (since it is binary, it will be probably smaller than any text representation), compress the backup. Upload the compressed file. At the main office decompress and restore every uploaded backup to a database dedicated to that branch office. There you have two options: use SELECT INTO statements to copy data from branch databases to the main one, or make your report queries to aggregate data from all branch databases.

If you choose to merge data, making the rows unique is really easy by using a primary key of two fields: the original one unique at branch level, and an id that is identifying the branch office itself. This way you can always see which data is coming from which branch office.

Good luck!


这篇关于c#web base应用程序中的复制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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