30 lines
		
	
	
		
			824 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			824 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using DigitalOps.Dal.DbEntity;
 | |
| using Microsoft.EntityFrameworkCore;
 | |
| using Npgsql;
 | |
| 
 | |
| namespace DigitalOps.Dal;
 | |
| 
 | |
| public class MainDbContext(DbContextOptions options) : MainDbScaffoldedContext(options) 
 | |
| {
 | |
|   static MainDbContext() => NpgsqlConnection.GlobalTypeMapper
 | |
|     .MapEnum<OrganizationRole>("organization_role");
 | |
| 
 | |
|   protected override void OnModelCreating(ModelBuilder modelBuilder)
 | |
|   {
 | |
|     base.OnModelCreating(modelBuilder);
 | |
|     
 | |
|     modelBuilder.HasPostgresEnum<OrganizationRole>("organization_role");
 | |
| 
 | |
|     modelBuilder.Entity<OrganizationUser>(entity =>
 | |
|     {
 | |
|       entity.Property(organizationUser => organizationUser.Role)
 | |
|         .HasColumnName("role")
 | |
|         .HasColumnType("organization_role");
 | |
|     });
 | |
|   }
 | |
|   
 | |
|   protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 | |
|   {
 | |
|     return;
 | |
|   }
 | |
| } |