Created
January 15, 2022 13:09
-
-
Save enisn/ff161c8e93e2ce044590da9118333145 to your computer and use it in GitHub Desktop.
Mastering at Source Generators - Extending TodoController via inheriting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Awesome.Api.Data; | |
namespace Awesome.Api.Controllers; | |
public abstract partial class TodoController | |
{ | |
} | |
public class CustomTodoController : TodoController | |
{ | |
public CustomTodoController(IRepository<Todo> repository) : base(repository) | |
{ | |
} | |
public override Task UpdateAsync(Guid id, Todo item) | |
{ | |
if (id == Guid.Empty) | |
{ | |
throw new ArgumentException("id can't be empty.",nameof(id)); | |
} | |
return base.UpdateAsync(id, item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment