开发者

Prevent the use of the locally installed VSTO if the Excel file originates from a different server

开发者 https://www.devze.com 2023-03-31 16:22 出处:网络
I have an Excel file which uses VSTO to retrieve and update data. This is deployed to various environments (Development, Staging, Production,...).

I have an Excel file which uses VSTO to retrieve and update data. This is deployed to various environments (Development, Staging, Production,...).

I want to make sure that a user who downloads a sheet from Staging isn't sending data to Production, because the sheet is using the (locally installed) VSTO which came from Production.

Is开发者_如何学编程 there a way to prevent this?


The whole concept of prod/staging/test is a definition thing that software won't magically understand so really the only way to deal with this is to code whatever logic you use into your vsto add-in.

The way we deal with this is that the add-in will check each sheet for a custom property named like: MYADDIN_ISTEST. If this property is found then the add-in will connect to the test database (for that sheet) and if not it will connect to the production database. You can think of all sort of variations to this theme depending on what makes sense for your environment but the reason for us to do it this way is that renaming or moving a file (with testdata) can be easily done by anyone without him/her realising the consequences. Going into the document's custom properties and removing that test property is something you will only do on purpose.

0

精彩评论

暂无评论...
验证码 换一张
取 消