Skip to content

Instantly share code, notes, and snippets.

@Chriz76
Last active May 15, 2021 19:11
Show Gist options
  • Save Chriz76/3a4f24cda3af34cb40f09d225d69c0d4 to your computer and use it in GitHub Desktop.
Save Chriz76/3a4f24cda3af34cb40f09d225d69c0d4 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 = "PostService", Version = "v1" });
});
services.AddDbContext<PostServiceContext>(options =>
options.UseSqlite(@"Data Source=post.db"));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, PostServiceContext 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