dll 中的二进制数据难以管理

发布于 2024-09-18 15:56:16 字数 414 浏览 5 评论 0原文

目前,我们在 C# 解决方案中将报告模板(word 文档)作为二进制数组存储在 dll 中。

public readonly static byte[] audit_engagement_template = new byte[] {208,207,17,224,161,177,26,225,0,0,0,0,0,0,0,0,...

等等。现在这个文件已经变得巨大并且非常难以管理,因为 Visual Studio 只要打开它就开始使用超过 2.5Gb 的内存。

我们曾经将此数据存储在数据库中,但是我们需要使数据库占用空间尽可能小,并减少从客户端打开/编辑这些模板时使用的带宽。这就是我们将这些文件直接移至解决方案中的原因。

任何人都可以建议任何存储这些文件的替代方案(并且不允许客户从应用程序外部接触它们)吗?

Currently we store report templates (word docs) as binary arrays within a dll in our C# solution.

public readonly static byte[] audit_engagement_template = new byte[] {208,207,17,224,161,177,26,225,0,0,0,0,0,0,0,0,...

Etc etc. Now this file has become HUGE and very unmanageable as Visual Studio starts using over 2.5Gb of memory whenever it is open.

We used to store this data in a database, however we need to make our database footprint as small as possible as well as reduce the bandwidth used when opening/editing these templates from the client's side. This is why we moved these files directly into the solution.

Can anyone suggest any alternatives on going about storing these files (and not allowing the clients to touch them from outside of the application)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撩心不撩汉 2024-09-25 15:56:17

不要将它们放入二进制数组中,而是尝试将文件作为嵌入资源包含在 DLL 中,然后使用 Assembly.GetManifestResourceStream 加载它们。检查一下,但我认为这可能会更有效......并且它肯定会更好地分离代码和数据。

Rather than putting them in binary arrays, try including the files as embedded resources in the DLL, then using Assembly.GetManifestResourceStream to load them. Check, but I think that may be more efficient... and it will certainly be a better separation of code and data.

沒落の蓅哖 2024-09-25 15:56:17

你使用什么数据库? SQL Server 将使用FILESTREAM 功能执行您想要的操作。它使用本地文件系统来存储文件,因此它们仅存在于文件夹中,但可以通过 SQL 访问它们。备份变得更加容易,并且可以轻松授予只读访问权限。

有关详细信息,请参阅MSDN 文章

What database are you using? SQL Server will do what you want using the FILESTREAM feature. It uses the local filesystem to store the files, so they simply exist in a folder, but they are accessed via SQL. Backing up becomes much easier, and it's easy to grant read-only access.

See the MSDN article for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文