public override async Task OnActivateAsync() { await using (var connection = dbConnectionFactory.CreateConnection()) { await connection.OpenAsync(); var value = await connection.GetAsync <TodoRecord>(this.GetPrimaryKey().ToString()); this.record = value; } }
public async Task Patch(TodoRecord newValue) { if (this.record.AssigneeId != null && newValue.AssigneeId != null && this.record.AssigneeId != newValue.AssigneeId) { throw new HttpResponseException(HttpStatusCode.BadRequest, "This todo has already been assigned to someone."); } logger.LogInformation(newValue.Description); await using (var connection = dbConnectionFactory.CreateConnection()) { await connection.OpenAsync(); await connection.UpdateAsync <TodoRecord>(newValue); } }
public async Task Patch(Guid id, [FromBody] TodoRecord input) { this.logger.LogInformation(input.ToString()); var grain = clusterClient.GetGrain <ITodoGrain>(id); await grain.Patch(input); }