Code reuse & SQL CLR

  • Thread starter Thread starter saarcarmi
  • Start date Start date
S

saarcarmi

Hi

How can I determine whether my code is ran from within the sql server
or not?

I want to write a block of code which opens a connection to the DB -
using a context connection if it resides in the SQL process and regualr
if it is not.

How could it be done?

Thanks saar
 
Check the value of Microsoft.SqlServer.Server.SqlContext.IsAvailable. If
it's true, your assembly is running within the SQLCLR host.
 
Back
Top