Skip to content

Instantly share code, notes, and snippets.

@Chriz76
Last active May 15, 2021 18:42
Show Gist options
  • Save Chriz76/f0814ec587d0022a044448ce768c3c5a to your computer and use it in GitHub Desktop.
Save Chriz76/f0814ec587d0022a044448ce768c3c5a to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "UserService", Version = "v1" });
});
services.AddDbContext<UserServiceContext>(options =>
options.UseSqlite(@"Data Source=user.db"));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserServiceContext dbContext)
{
if (env.IsDevelopment())
{
dbContext.Database.EnsureCreated();
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment