If I am executing within the context of a particular service instance and operation, how do I get access to the currently-executing service instance? Service instances don't inherit from any specific common base class or interface and the only pathway into the existing context that I can find is:
OperationContext.Current
but I can't seem to find any properties that reference the actual service instance itself so that I can cast it to what I know it should be and perform operations on it.
Without exploring why I am doing this (it's irrelevant), please let me know if there is any way to find the reference I am looking for.
EDIT:
[ServiceContract]
public interface IInventory
{
[OperationContract]
List<DealInfo> ListDeals(DealQueryOptions options);
}
// This is the object I will need access to the current instance of
public class Inventory : ServiceBase<Inventory>, IInventory
{
public List<DealInfo> ListDeals(DealQueryOptions options)
{
var obj = new Whatever(); // see below
}
}
public class Whatever
{
public Whatever()
{
// how do I get access to the service instance here?
// assume that in this context we are not allowed to
// pass the service instance to this class; this class
// must automatically discover the instance itself.
}
}