Guides for Serilog and EFCore (#2134)

* Add serilog guide

* added suggestions from Rozen

* Add efcore guide

* Fix review changes

* Fix grammatical errors & review points
This commit is contained in:
Duke
2022-03-02 20:08:51 +01:00
committed by GitHub
parent 7d8911bfed
commit 1fc07e742f
10 changed files with 213 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
using Discord;
public class SampleModule : InteractionModuleBase<SocketInteractionContext>
{
private readonly ApplicationDbContext _db;
public SampleModule(ApplicationDbContext db)
{
_db = db;
}
[SlashCommand("sample", "sample")]
public async Task Sample()
{
// Do stuff with your injected DbContext
var user = _db.Users.FirstOrDefault(x => x.Id == Context.User.Id);
...
}
}