1 |
caa28567
|
Vojtěch Bartička
|
using Core.Entities;
|
2 |
|
|
using Microsoft.EntityFrameworkCore;
|
3 |
ebb51a7f
|
Vojtěch Bartička
|
using Microsoft.Extensions.Configuration;
|
4 |
caa28567
|
Vojtěch Bartička
|
using System;
|
5 |
|
|
using System.Collections.Generic;
|
6 |
8c9ce202
|
Vojtěch Bartička
|
using System.ComponentModel.DataAnnotations.Schema;
|
7 |
caa28567
|
Vojtěch Bartička
|
using System.Linq;
|
8 |
|
|
using System.Text;
|
9 |
|
|
using System.Threading.Tasks;
|
10 |
|
|
|
11 |
|
|
namespace Core.Contexts
|
12 |
|
|
{
|
13 |
|
|
public class DatabaseContext : DbContext
|
14 |
|
|
{
|
15 |
ebb51a7f
|
Vojtěch Bartička
|
private readonly IConfiguration _configuration;
|
16 |
|
|
|
17 |
|
|
public DatabaseContext(IConfiguration configuration)
|
18 |
|
|
{
|
19 |
|
|
_configuration = configuration;
|
20 |
|
|
}
|
21 |
|
|
|
22 |
caa28567
|
Vojtěch Bartička
|
public DbSet<DocumentContent> DocumentContents { get; set; }
|
23 |
|
|
public DbSet<Document> Documents { get; set; }
|
24 |
|
|
public DbSet<User> Users { get; set; }
|
25 |
|
|
public DbSet<Annotation> Annotations { get; set; }
|
26 |
|
|
public DbSet<Class> Classes { get; set; }
|
27 |
|
|
public DbSet<AnnotationTag> AnnotationTags { get; set; }
|
28 |
|
|
public DbSet<Tag> Tags { get; set; }
|
29 |
|
|
public DbSet<SubTag> SubTags { get; set; }
|
30 |
|
|
public DbSet<TagCategory> TagCategories { get; set; }
|
31 |
ceb95b98
|
Vojtěch Bartička
|
public DbSet<ConfigurationItem> ConfigurationItems { get; set; }
|
32 |
fe0ccf07
|
Vojtěch Bartička
|
public DbSet<FinalAnnotation> FinalAnnotations { get; set; }
|
33 |
|
|
public DbSet<FinalAnnotationTag> FinalAnnotationTags { get; set; }
|
34 |
caa28567
|
Vojtěch Bartička
|
|
35 |
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
36 |
|
|
{
|
37 |
005202c6
|
Vojtěch Bartička
|
optionsBuilder.UseNpgsql(_configuration["ConnectionString"], b => b.MigrationsAssembly("RestAPI"));
|
38 |
|
|
//optionsBuilder.UseNpgsql("Host=localhost:5432;Database=dbo;Username=myuser;Password=password");
|
39 |
caa28567
|
Vojtěch Bartička
|
}
|
40 |
8c9ce202
|
Vojtěch Bartička
|
|
41 |
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
42 |
|
|
{
|
43 |
|
|
}
|
44 |
caa28567
|
Vojtěch Bartička
|
}
|
45 |
|
|
}
|