Currently we store report templates (word docs) as binary arrays within a dll in our C# solution.
public readonly static byte[] audit_engagement_开发者_如何学JAVAtemplate = 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)?
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.
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.
精彩评论