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