VoteContext.cs 447 B

12345678910111213141516171819
  1. using Microsoft.EntityFrameworkCore;
  2. namespace Worker.Entities
  3. {
  4. public class VoteContext : DbContext
  5. {
  6. private static bool _EnsureCreated;
  7. public VoteContext(DbContextOptions options) : base(options)
  8. {
  9. if (!_EnsureCreated)
  10. {
  11. Database.EnsureCreated();
  12. _EnsureCreated = true;
  13. }
  14. }
  15. public DbSet<Vote> Votes { get; set; }
  16. }
  17. }