Skip to content

Commit

Permalink
Merge pull request #3967 from zyhfish/task/update-template-db-factory
Browse files Browse the repository at this point in the history
add db factory class into the module template.
  • Loading branch information
sbwalker authored Mar 8, 2024
2 parents 404964d + 11b5cc8 commit 128ebe2
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 128ebe2

Please sign in to comment.