Add project files.
This commit is contained in:
		
							
								
								
									
										25
									
								
								Core.Blueprint.DAL.SQLServer/Context/SqlServerContext.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Core.Blueprint.DAL.SQLServer/Context/SqlServerContext.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| using Core.Blueprint.DAL.SQLServer.Entities; | ||||
| using Core.Blueprint.SQLServer.Entities; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Core.Blueprint.DAL.SQLServer.Context | ||||
| { | ||||
|     public sealed class SqlServerContext : DbContext | ||||
|     { | ||||
|         public SqlServerContext(DbContextOptions<SqlServerContext> options) : base(options) { } | ||||
|         public DbSet<UserProject> UserProjects { get; set; } | ||||
|  | ||||
|         protected override void OnModelCreating(ModelBuilder modelBuilder) | ||||
|         { | ||||
|             foreach (var entityType in modelBuilder.Model.GetEntityTypes() | ||||
|                 .Where(t => typeof(BaseSQLAdapter).IsAssignableFrom(t.ClrType))) | ||||
|             { | ||||
|                 modelBuilder.Entity(entityType.ClrType) | ||||
|                     .HasKey("Id"); | ||||
|  | ||||
|                 modelBuilder.Entity(entityType.ClrType).Property("Status") | ||||
|                     .HasConversion<string>(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin