SHARE
TWEET

Untitled

a guest Feb 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public interface IConverterService
  2. {
  3.     object ConvertData(object sourceData);
  4. }
  5.    
  6. public class ConverterService : IConverterService
  7. {
  8.     private ISettingsProvider _settingsProvider;
  9.  
  10.     public ConverterService(ISettingsProvider settingsProvider)
  11.     {
  12.         _settingsProvider = settingsProvider;
  13.  
  14.         // Do some one-time initialisation using info from settingsProvider
  15.         // and store the results in class variables (not shown), used by ConvertData.
  16.     }
  17.  
  18.     public object ConvertData(object sourceData)
  19.     {
  20.         // Do the conversion - also uses _settingsProvider,
  21.         // and other variables initialised in the constructor ..
  22.     }
  23. }
  24.    
  25. container.Register(Component.For<IConverterService>().ImplementedBy<ConverterService>().LifeStyle.Singleton);
  26. container.Register(Component.For<ISettingsProvider>().ImplementedBy<SettingsProvider>().LifeStyle.Singleton);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top