Merge pull request #3967 from zyhfish/task/update-template-db-factory
add db factory class into the module template.
This commit is contained in:
commit
128ebe2cb2
25
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]DbContextFactory.cs
vendored
Normal file
25
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]DbContextFactory.cs
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Oqtane.Infrastructure;
|
||||||
|
|
||||||
|
namespace [Owner].Module.[Module].Repository
|
||||||
|
{
|
||||||
|
public class [Module]DbContextFactory : IServerStartup
|
||||||
|
{
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
// not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureMvc(IMvcBuilder mvcBuilder)
|
||||||
|
{
|
||||||
|
// not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddDbContextFactory<[Module]Context>(opt => { }, ServiceLifetime.Transient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user