aboutsummaryrefslogtreecommitdiff
path: root/API/Database/DevHiveContext.cs
blob: c20e9ebd5265421320b9cb9bd32ef20d09093a4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Microsoft.AspNetCore;
using Microsoft.EntityFrameworkCore;
using Models.Classes;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;

namespace API.Database
{
	public class DevHiveContext : IdentityDbContext<User, IdentityRole<int>, int>
	{
		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>()
				.HasKey(x => x.Id);

			builder.Entity<Language>()
				.HasKey(x => x.Id);

			builder.Entity<Technology>()
				.HasKey(x => x.Id);

			base.OnModelCreating(builder);
		}
	}
}