Пример #1
0
 /// <inheritdoc />
 public FakeMQProcess Get(string handlerType)
 {
     using var context = FakeMQDbContext.GetContext(serviceProvider);
     return(context.FakeMQProcesses
            .AsNoTracking()
            .FirstOrDefault(_ => _.HandlerType == handlerType));
 }
Пример #2
0
 /// <inheritdoc />
 public IEnumerable <FakeMQEvent> Get(string type, DateTimeOffset fromTime, DateTimeOffset toTime)
 {
     using var context = new FakeMQDbContext(dbConnectionString);
     return(context.FakeMQEvents.AsNoTracking()
            .Where(_ => _.Type == type && _.CreateTime > fromTime && _.CreateTime < toTime)
            .OrderBy(_ => _.CreateTime)
            .ToList());
 }
Пример #3
0
 /// <inheritdoc />
 public IEnumerable <FakeMQEvent> Get(string type, DateTimeOffset fromTime, DateTimeOffset toTime)
 {
     using var context = FakeMQDbContext.GetContext(serviceProvider);
     return(context.FakeMQEvents
            .AsNoTracking()
            .Where(_ => _.Type == type && _.CreateTime > fromTime && _.CreateTime <= toTime)
            .OrderBy(_ => _.CreateTime)
            .ToList());
 }
Пример #4
0
 /// <inheritdoc />
 public void Add(FakeMQProcess process)
 {
     using var context = new FakeMQDbContext(dbConnectionString);
     if (context.FakeMQProcesses.Any(_ => _.HandlerType == process.HandlerType))
     {
         return;
     }
     context.FakeMQProcesses.Add(process);
     context.SaveChanges();
 }
Пример #5
0
 /// <inheritdoc />
 public void Add(FakeMQProcess process)
 {
     using var context = FakeMQDbContext.GetContext(serviceProvider);
     if (context.FakeMQProcesses.Any(_ => _.HandlerType == process.HandlerType))
     {
         return;
     }
     context.FakeMQProcesses.Add(process);
     context.SaveChanges();
 }
Пример #6
0
        /// <inheritdoc />
        public void Delete(string handlerType)
        {
            using var context = new FakeMQDbContext(dbConnectionString);
            var item = context.FakeMQProcesses.SingleOrDefault(_ => _.HandlerType == handlerType);

            if (item == null)
            {
                return;
            }
            context.FakeMQProcesses.Remove(item);
            context.SaveChanges();
        }
Пример #7
0
        /// <inheritdoc />
        public void Update(string handlerType, DateTimeOffset handleTime)
        {
            using var context = new FakeMQDbContext(dbConnectionString);
            var item = context.FakeMQProcesses.SingleOrDefault(_ => _.HandlerType == handlerType);

            if (item == null)
            {
                return;
            }
            item.LastHandleTime = handleTime;
            context.SaveChanges();
        }
Пример #8
0
        /// <inheritdoc />
        public void Delete(string handlerType)
        {
            using var context = FakeMQDbContext.GetContext(serviceProvider);
            var item = context.FakeMQProcesses
                       .AsTracking()
                       .FirstOrDefault(_ => _.HandlerType == handlerType);

            if (item == null)
            {
                return;
            }
            context.FakeMQProcesses.Remove(item);
            context.SaveChanges();
        }
Пример #9
0
        /// <inheritdoc />
        public void Update(string handlerType, DateTimeOffset handleTime)
        {
            using var context = FakeMQDbContext.GetContext(serviceProvider);
            var item = context.FakeMQProcesses
                       .AsTracking()
                       .FirstOrDefault(_ => _.HandlerType == handlerType);

            if (item == null)
            {
                return;
            }
            item.LastHandleTime = handleTime;
            context.SaveChanges();
        }
Пример #10
0
 /// <inheritdoc />
 public FakeMQProcess Get(string handlerType)
 {
     using var context = new FakeMQDbContext(dbConnectionString);
     return(context.FakeMQProcesses.AsNoTracking()
            .SingleOrDefault(_ => _.HandlerType == handlerType));
 }
Пример #11
0
 /// <inheritdoc />
 public void Add(FakeMQEvent @event)
 {
     using var context = FakeMQDbContext.GetContext(serviceProvider);
     context.FakeMQEvents.Add(@event);
     context.SaveChanges();
 }
Пример #12
0
 /// <inheritdoc />
 public void Add(FakeMQEvent @event)
 {
     using var context = new FakeMQDbContext(dbConnectionString);
     context.FakeMQEvents.Add(@event);
     context.SaveChanges();
 }