Вытащил солюшен на уровень выше, чтобы прощё было дотнетить
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							
								
								
									
										39
									
								
								Infrastructure/Database/DatabaseContext.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Infrastructure/Database/DatabaseContext.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| using System.Reflection; | ||||
| using ApplicationLayer.InfrastructureServicesInterfaces; | ||||
| using Infrastructure.Database.Generic; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database; | ||||
|  | ||||
| public class DatabaseContext(DbContextOptions<DatabaseContext> opts) : DbContext(opts), IGenericWriter, IGenericReader, IUnitOfWork | ||||
| { | ||||
|     protected override void OnModelCreating(ModelBuilder modelBuilder) | ||||
|     { | ||||
|         modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); | ||||
|     } | ||||
|  | ||||
|     async Task IGenericWriter.AddAsync<T>(T entity, CancellationToken cancellationToken) | ||||
|     { | ||||
|         await AddAsync(entity, cancellationToken); | ||||
|     } | ||||
|  | ||||
|     void IGenericWriter.Update<T>(T entity) | ||||
|     { | ||||
|         Update(entity); | ||||
|     } | ||||
|  | ||||
|     void IGenericWriter.Remove<T>(T entity) | ||||
|     { | ||||
|         Remove(entity); | ||||
|     } | ||||
|  | ||||
|     IQueryable<T> IGenericReader.GetAll<T>() | ||||
|     { | ||||
|         return Set<T>(); | ||||
|     } | ||||
|  | ||||
|     async Task IUnitOfWork.SaveAsync(CancellationToken cancellationToken) | ||||
|     { | ||||
|         await SaveChangesAsync(cancellationToken); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user