Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: Two Singleton Instances

$
0
0
I am wondering if it is possible to have two singleton instances. I have a following scenario described below. I am looking for a way by which firstDeviceDriver and secondDeviceDriver are different instances however in different Algo files they behave as singletons, i.e secondDeviceDriver in both the algo files refer to the same instance.

I am also open on any tricks we can play to make it work ,except creating two devicedriver exports.

--------------------dll one --------------------
[Export]
public class DeviceDriverA
{
}
-------------------- dll two --------------------------
public class AlgoOne
{
  [Import(DeviceDriverA)]   
  public DeviceDriverA firstDeviceDriver {get;set;}

  [Import(DeviceDriverA)]   
  public DeviceDriverA secondDeviceDriver {get;set;}
}

-------------------- dll three --------------------------
public class AlgoTwo
{
  [Import(DeviceDriverA)]   
  public DeviceDriverA secondDeviceDriver {get;set;}
}

Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>