aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories/DevHiveContext.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-14 23:29:14 +0200
committertranstrike <transtrike@gmail.com>2020-12-14 23:29:14 +0200
commitdee2e37a4a8759108390c664e06bf147b8385cbf (patch)
treebd65fe5649731a55aa6f1d8b48d53d89032fb8be /src/DevHive.Data/Repositories/DevHiveContext.cs
parent1ccdefdac025b1b986ad2bd0bc3eda7505d6e7c3 (diff)
downloadDevHive-dee2e37a4a8759108390c664e06bf147b8385cbf.tar
DevHive-dee2e37a4a8759108390c664e06bf147b8385cbf.tar.gz
DevHive-dee2e37a4a8759108390c664e06bf147b8385cbf.zip
Stabalized project for compilation. Next step after init architecture
Diffstat (limited to 'src/DevHive.Data/Repositories/DevHiveContext.cs')
-rw-r--r--src/DevHive.Data/Repositories/DevHiveContext.cs26
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);
+ }
+ }
+}