From 3fc676497f4a4b1671e31cc3b8cd3e4c6ac96920 Mon Sep 17 00:00:00 2001 From: transtrike Date: Sat, 19 Dec 2020 14:35:08 +0200 Subject: ALmost solved DP --- src/DevHive.Data/DevHiveContext.cs | 35 +++++++++++++++++++++++++ src/DevHive.Data/Repositories/DevHiveContext.cs | 35 ------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 src/DevHive.Data/DevHiveContext.cs delete mode 100644 src/DevHive.Data/Repositories/DevHiveContext.cs (limited to 'src/DevHive.Data') diff --git a/src/DevHive.Data/DevHiveContext.cs b/src/DevHive.Data/DevHiveContext.cs new file mode 100644 index 0000000..e8eb5fb --- /dev/null +++ b/src/DevHive.Data/DevHiveContext.cs @@ -0,0 +1,35 @@ +using System; +using DevHive.Data.Models; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace DevHive.Data +{ + public class DevHiveContext : IdentityDbContext + { + 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(); + + builder.Entity() + .HasMany(x => x.Roles); + + builder.Entity() + .HasMany(x => x.Friends); + + builder.Entity() + .HasIndex(x => x.Id) + .IsUnique(); + + base.OnModelCreating(builder); + } + } +} diff --git a/src/DevHive.Data/Repositories/DevHiveContext.cs b/src/DevHive.Data/Repositories/DevHiveContext.cs deleted file mode 100644 index 7fa8130..0000000 --- a/src/DevHive.Data/Repositories/DevHiveContext.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using DevHive.Data.Models; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; - -namespace DevHive.Data.Repositories -{ - public class DevHiveContext : IdentityDbContext - { - 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(); - - builder.Entity() - .HasMany(x => x.Roles); - - builder.Entity() - .HasMany(x => x.Friends); - - builder.Entity() - .HasIndex(x => x.Id) - .IsUnique(); - - base.OnModelCreating(builder); - } - } -} -- cgit v1.2.3