By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

I heard there is some trick to referencing statics in C# CLR stored procedure without having to mark the assembly as unsafe. Does anyone know this? This is usefull as the case of needing a little static shared variable here and there without having t

P: n/a
DR
I heard there is some trick to referencing statics in C# CLR stored
procedure without having to mark the assembly as unsafe. Does anyone know
this? This is usefull as the case of needing a little static shared variable
here and there without having to compromise safety in the Sql Server 2005.
Oct 29 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"DR" <so*******************@yahoo.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
>I heard there is some trick to referencing statics in C# CLR stored
procedure without having to mark the assembly as unsafe. Does anyone know
this? This is usefull as the case of needing a little static shared
variable here and there without having to compromise safety in the Sql
Server 2005.
Never heard of such "trick", anyway, if such trick would exist, it would
compromise SQL Server's safety, also it makes little sense to rely on
statics in this environment, the statics will get re-initialized after an AD
reload. Your best bet is to save shared values in the database.

Willy.
Oct 29 '07 #2

P: n/a
DR
shared values in db is not acceptable when i need to store then in a memory
resident hash table with no extra fat.

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:O5**************@TK2MSFTNGP03.phx.gbl...
"DR" <so*******************@yahoo.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
>>I heard there is some trick to referencing statics in C# CLR stored
procedure without having to mark the assembly as unsafe. Does anyone know
this? This is usefull as the case of needing a little static shared
variable here and there without having to compromise safety in the Sql
Server 2005.

Never heard of such "trick", anyway, if such trick would exist, it would
compromise SQL Server's safety, also it makes little sense to rely on
statics in this environment, the statics will get re-initialized after an
AD reload. Your best bet is to save shared values in the database.

Willy.


Oct 29 '07 #3

P: n/a
What kind of value do you need to store? A value in the database might
be the only option here. If you want to reduce the overhead of having to
query the database from inside the CLR stored procedure, do the query for
the value outside of the CLR stored procedure (in a wrapper) and then pass
your static value in (perhaps make it an output variable if the value needs
to be set).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DR" <so*******************@yahoo.comwrote in message
news:O8**************@TK2MSFTNGP05.phx.gbl...
shared values in db is not acceptable when i need to store then in a
memory resident hash table with no extra fat.

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:O5**************@TK2MSFTNGP03.phx.gbl...
>"DR" <so*******************@yahoo.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
>>>I heard there is some trick to referencing statics in C# CLR stored
procedure without having to mark the assembly as unsafe. Does anyone know
this? This is usefull as the case of needing a little static shared
variable here and there without having to compromise safety in the Sql
Server 2005.

Never heard of such "trick", anyway, if such trick would exist, it would
compromise SQL Server's safety, also it makes little sense to rely on
statics in this environment, the statics will get re-initialized after an
AD reload. Your best bet is to save shared values in the database.

Willy.


Oct 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more C# / C Sharp Questions on Bytes