From dee2e37a4a8759108390c664e06bf147b8385cbf Mon Sep 17 00:00:00 2001 From: transtrike Date: Mon, 14 Dec 2020 23:29:14 +0200 Subject: Stabalized project for compilation. Next step after init architecture --- src/DevHive.Data/Repositories/DevHiveContext.cs | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/DevHive.Data/Repositories/DevHiveContext.cs (limited to 'src/DevHive.Data/Repositories/DevHiveContext.cs') 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, Guid> + { + public DevHiveContext(DbContextOptions options) + : base(options) { } + + public DbSet Technologies { get; set; } + public DbSet Languages { get; set; } + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasIndex(x => x.UserName) + .IsUnique(); + + base.OnModelCreating(builder); + } + } +} -- cgit v1.2.3