diff options
Diffstat (limited to 'src/DevHive.Data/Repositories/DevHiveContext.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/DevHiveContext.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/DevHive.Data/Repositories/DevHiveContext.cs b/src/DevHive.Data/Repositories/DevHiveContext.cs new file mode 100644 index 0000000..be5cc56 --- /dev/null +++ b/src/DevHive.Data/Repositories/DevHiveContext.cs @@ -0,0 +1,26 @@ +using System; +using DevHive.Data.Models; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace DevHive.Data.Repositories +{ + public class DevHiveContext : IdentityDbContext<User, IdentityRole<Guid>, Guid> + { + public DevHiveContext(DbContextOptions options) + : base(options) { } + + public DbSet<Technology> Technologies { get; set; } + public DbSet<Language> Languages { get; set; } + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity<User>() + .HasIndex(x => x.UserName) + .IsUnique(); + + base.OnModelCreating(builder); + } + } +} |
