I have a CLR stored procedure defined in the below class. I am using property injection for MyObject but I'm not sure if it's thread-safe? Note: the CLR stored procedure needs to be static.
public class MyClass
{
private static IMyObject _myObj;
public static IMyObject MyObject
{
get { return _myObj ?? new MyObject(); }
set {_myObj = value; }
}
static MyClass()
{
_myObj = MyObject;
}
public static void My_Stored_Procedure()
{
_myObj.DoStuff();
}
}
Mainly the reason for adding the static property is for unit testing.