SHARE
TWEET

Untitled

a guest Jun 26th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public abstract class BO<TConfig> where TConfig : BOConfigBase
  2. {
  3.     protected TConfig Config { get; set; }
  4.     internal List<BC> _BCs { get; set; }
  5.  
  6.     public abstract void Init();
  7.  
  8.     public void Process() => _BCs.ForEach(bc => bc.Process());
  9. }
  10.  
  11. public class BOOne : BO<BOConfigOne>
  12. {
  13.     public BOOne(BOConfigOne config)
  14.     {
  15.         Config = config;
  16.     }
  17.  
  18.     public override void Init()
  19.     {
  20.         _BCs = new List<BC>()
  21.         {
  22.             BCA.Init(Config),
  23.             BCB.Init(Config),
  24.             BCC.Init(Config),
  25.             BCOneA.Init(Config)
  26.         };
  27.     }
  28. }
  29.      
  30. public abstract class BC
  31. {
  32.     protected BOConfigBase Config { get; set; }
  33.     public abstract void Process();
  34. }
  35.  
  36. public class BCA : BC
  37. {
  38.     private BCA()
  39.     {
  40.     }
  41.  
  42.     public static BCA Init(BOConfigBase config)
  43.     {
  44.         BCA ret = new BCA { Config = config };
  45.         return ret;
  46.     }
  47.  
  48.     public override void Process()
  49.     {
  50.         Config.Counter += 1;
  51.     }
  52. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top