Assuming that the model file (i.e. the value of the static variable) does not change after loading, you should set the static variable as readonly , which can be set in the constructor of the same class or after the declaration.
Here is the MSDN page for readonly .
Another option is to modify your code to put this data inside the collection, and then mark this collection as readonly . Once you are marked as readonly , the assembly cannot be reassigned, but you can still use the Add and Remove methods to add elements to it and remove elements from it. This will allow you to mark Assembly as SAFE . Please see my answer to another S.O. Question for more details:
Is it possible to change readonly static variables in C # SQLCLR?
Solomon rutzky
source share