private ICarOperation GetOperation(string opName)
 {
     if (Container.IsRegistered <ICarOperation>(opName))
     {
         ICarOperation op = Container.Resolve <ICarOperation>(opName);
         return(op);
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
示例#2
0
 public CarController(ICarOperation operation)
 {
     _operation = operation;
 }
示例#3
0
 public CarController()
 {
     _operation = new CarOperation();
 }
        public void Execute(ICar car)
        {
            ICarOperation op = GetOperation(car.Command.ToString());

            op.DoOperation(car);
        }