简体   繁体   English

在组装中存储大量数据

[英]Store huge amount of data in assembly

I'm trying to make an assembly which I can use in mutliple programs. 我正在尝试制作可以在多程序程序中使用的程序集。 The assembly contains a huge amount of countries and a huge amount of towns in that country. 议会中包含大量国家和该国大量城镇。 the data for countries is not much of a problem because I only count 249 countries but I also have huge amount of data for towns. 国家/地区的数据不是什么大问题,因为我只计算249个国家/地区,但我也有大量的城镇数据。

For example france has nearly 50.000 towns. 例如,法国有近50.000个城镇。 Belgium has nearly 2500 towns. 比利时有近2500个城镇。 United kingdom nearly 150.000 towns. 英国近15万个城镇。 ... ...

I already have all the data I need but my problem is. 我已经有了所需的所有数据,但是我的问题是。 I have no idea how to store the data in my assembly. 我不知道如何在我的程序集中存储数据。 - I tried XML but loading the xml give me performance issues. -我尝试过XML,但加载xml会给我带来性能问题。 It takes to long to load the data. 加载数据需要很长时间。 - I tried a MS Access database but then the data is store in a database outside my assembly while I try to keep the data inside my assembly. -我尝试使用MS Access数据库,但随后尝试将数据保留在程序集中时,数据存储在程序集外部的数据库中。 which means thats not my solution to. 这意味着那不是我的解决方案。 - I tried loading the data directly in an array in my script but then my visual studio keep loading all day long checking the data I entered but I can't work with it anymore -我尝试将数据直接加载到脚本中的数组中,但是我的Visual Studio整天一直在加载,以检查输入的数据,但现在无法使用了

Anyone can give me a way to store data in my assembly without having these performance issues? 任何人都可以给我一种在我的程序集中存储数据而又不会出现这些性能问题的方法吗?

Any help is welcome. 欢迎任何帮助。

I work with visual studio 2010 in the language C# 我使用C#语言与Visual Studio 2010合作

If you are determined to hardcode it into an assembly you could go down the route of multiple Dll's containing each country. 如果您决定将其硬编码为程序集,则可以沿着每个国家/地区包含多个Dll的路线进行。

They way if you only need to access the France file you can just create an instance of the France class and not the whole world. 它们以这种方式,如果您只需要访问France文件,则可以只创建France类的实例,而不是整个世界。

you may want to look at geo coding instead. 您可能要改用地理编码。 i once used a dat file that had a bunch of US Zip Codes and that info in it. 我曾经使用过一个dat文件,其中包含一堆美国邮政编码和其中的信息。 I am sure similar things exist elsewhere. 我相信其他地方也有类似的事情。

you may just want to look at google geo coding though. 您可能只想查看Google地理编码。

It wouldnt be a very good idea to keep all that data inside your assembly. 将所有数据保留在程序集中不是一个好主意。 1. It makes it very large. 1.它非常大。 2. It is difficult to update. 2.难以更新。

If you are worried about other people seeing the information in a database or xml document outside your assembly you should look into some basic encryption. 如果您担心其他人在程序集之外看到数据库或xml文档中的信息,则应该研究一些基本的加密方法。

EDIT: 1. Having a very large assembly would be a poor idea due to having to load all that information into memory unnecessarly. 编辑:1.具有很大的程序集将是一个糟糕的主意,因为必须将所有这些信息不必要地加载到内存中。 This is assuming that the program does not need 100% of the information every time it runs. 这是假定该程序每次运行都不需要100%的信息。

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

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