private static void OnFridgeAdded(object sender, NATS.Client.MsgHandlerEventArgs evt) { var eventMessage = MessageHelper.FromData <FridgeAddedEvent>(evt.Message.Data); var fridge = eventMessage.Fridge; using (var context = new FreezrContext(dbOptions.Options)) { context.Fridges.Add(fridge); context.SaveChanges(); } EventCounter.Inc(); }
public FridgeRepository(FreezrContext freezrContext) { this.freezrContext = freezrContext; }