Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Last active June 19, 2020 23:39
Show Gist options
  • Save httpmurilo/6b999eb41f1ea522d979fdd562af73c9 to your computer and use it in GitHub Desktop.
Save httpmurilo/6b999eb41f1ea522d979fdd562af73c9 to your computer and use it in GitHub Desktop.
construtor
using System;
using Faculdade.Api.Data;
using Microsoft.AspNetCore.Mvc;
namespace Faculdade.Api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class AutorController
{
private readonly DataContext _context;
public AutorController(DataContext context)
{
_context = context ??
throw new ArgumentNullException(nameof(context));
_context.Database.EnsureCreated();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment