aspnet / WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
Apache License 2.0
627 stars 439 forks source link

DbWebHookStore should use a factory method for creating the context #159

Closed NicolasDorier closed 6 years ago

NicolasDorier commented 7 years ago

DbWebHookStore should allow the user to either overrides or inject how to create the DBContext. I would say the .NET Core way of doing would be able to inject DbContextOptionsBuilder<TContext>. This can be used to create a new DBContext.

https://github.com/aspnet/WebHooks/blob/dougbu/add.core.II/src/Microsoft.AspNet.WebHooks.Custom.SqlStorage/WebHooks/DbWebHookStore.cs

danroth27 commented 6 years ago

For the ASP.NET Core when we add support for senders we expect that the DbContext to come from DI.

We don't plan to add this support to the ASP.NET implementation.

NicolasDorier commented 6 years ago

The link was referencing the core branch, not ASP.NET MVC.

dougbu commented 6 years ago

The Core branch does not include any changes to the senders. When we convert them to ASP.NET Core, DI will be the default and the DbContexts can be added however you prefer.

The default DI implementation in ASP.NET Core supports types, instances, and lambda expression factories. You may also use another DI implementation.