Esempio n. 1
0
 public LogReservationsRepository(
     IReservationsRepository inner,
     ScopedLog log)
 {
     Inner = inner;
     Log   = log;
 }
Esempio n. 2
0
        public object Create(ControllerContext context)
        {
            var controllerType =
                context.ActionDescriptor.ControllerTypeInfo.AsType();

            if (controllerType == typeof(ReservationsController))
            {
                var l          = new ScopedLog(new FileLog(LogFile));
                var controller = new ReservationsController(
                    SeatingDuration,
                    Tables,
                    new LogReservationsRepository(
                        new SqlReservationsRepository(ConnectionString),
                        l),
                    new LogClock(
                        new SystemClock(),
                        l));
                Logs.AddOrUpdate(controller, l, (_, x) => x);
                return(controller);
            }

            throw new InvalidOperationException(
                      $"Unknown controller type: {controllerType}.");
        }
 public LogClock(IClock inner, ScopedLog log)
 {
     Inner = inner;
     Log   = log;
 }