Changeset 99c1e45 for ChapterX.Infrastructure
- Timestamp:
- 06/24/26 16:28:50 (12 days ago)
- Branches:
- main
- Children:
- a8f4a2d
- Parents:
- 0b502c2
- Location:
- ChapterX.Infrastructure
- Files:
-
- 4 edited
-
Data/DataContext/ApplicationDbContext.cs (modified) (1 diff)
-
Repositories/ChapterRepository.cs (modified) (1 diff)
-
Repositories/GenericRepository.cs (modified) (1 diff)
-
Repositories/StoryRepository.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ChapterX.Infrastructure/Data/DataContext/ApplicationDbContext.cs
r0b502c2 r99c1e45 88 88 e.Property(x => x.Id).HasColumnName("story_id"); 89 89 e.Property(x => x.MatureContent).HasColumnName("mature_content"); 90 e.Property(x => x.Title).HasColumnName("title"); 90 91 e.Property(x => x.ShortDescription).HasColumnName("short_description"); 91 92 e.Property(x => x.Image).HasColumnName("image"); -
ChapterX.Infrastructure/Repositories/ChapterRepository.cs
r0b502c2 r99c1e45 31 31 .FirstOrDefaultAsync(c => c.Id == id, cancellationToken); 32 32 } 33 34 public async Task IncrementViewCountAsync(int id, CancellationToken cancellationToken = default) 35 { 36 await _dbSet 37 .Where(c => c.Id == id) 38 .ExecuteUpdateAsync(s => s.SetProperty(c => c.ViewCount, c => c.ViewCount + 1), cancellationToken); 39 } 33 40 } 34 41 } -
ChapterX.Infrastructure/Repositories/GenericRepository.cs
r0b502c2 r99c1e45 18 18 } 19 19 20 public async Task<T?> GetByIdAsync(int id, CancellationToken cancellationToken = default)20 public virtual async Task<T?> GetByIdAsync(int id, CancellationToken cancellationToken = default) 21 21 => await _dbSet.FindAsync([id], cancellationToken); 22 22 -
ChapterX.Infrastructure/Repositories/StoryRepository.cs
r0b502c2 r99c1e45 25 25 } 26 26 27 public override async Task<Story?> GetByIdAsync(int id, CancellationToken cancellationToken = default) 28 { 29 return await _dbSet 30 .Include(s => s.HasGenres) 31 .ThenInclude(hg => hg.Genre) 32 .Include(s => s.Writer) 33 .ThenInclude(w => w!.User) 34 .Include(s => s.Likes) 35 .Include(s => s.Comments) 36 .Include(s => s.Chapters) 37 .FirstOrDefaultAsync(s => s.Id == id, cancellationToken); 38 } 39 27 40 public async Task<IEnumerable<Story>> GetByWriterIdAsync(int writerId, CancellationToken cancellationToken = default) 28 41 {
Note:
See TracChangeset
for help on using the changeset viewer.
