Migrating to modern c# namespace

Using the short namesapce declaration for conciseness
This commit is contained in:
kdeng00
2023-04-09 12:34:06 -04:00
parent 37cfda84b5
commit c17c9cd329
48 changed files with 3402 additions and 3454 deletions
+20 -21
View File
@@ -6,32 +6,31 @@ using Microsoft.EntityFrameworkCore;
using Icarus.Models;
namespace Icarus.Database.Contexts
namespace Icarus.Database.Contexts;
public class GenreContext : DbContext
{
public class GenreContext : DbContext
public DbSet<Genre> Genres { get; set; }
public GenreContext(DbContextOptions<GenreContext> options) : base(options) { }
public GenreContext(string connString) : base(new DbContextOptionsBuilder<GenreContext>()
.UseMySQL(connString).Options)
{
public DbSet<Genre> Genres { get; set; }
public GenreContext(DbContextOptions<GenreContext> options) : base(options) { }
public GenreContext(string connString) : base(new DbContextOptionsBuilder<GenreContext>()
.UseMySQL(connString).Options)
{
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Genre>()
.ToTable("Genre");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Genre>()
.ToTable("Genre");
}
public Genre RetrieveRecord(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID);
}
public Genre RetrieveRecord(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID);
}
public bool DoesRecordExist(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID) != null ? true : false;
}
public bool DoesRecordExist(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID) != null ? true : false;
}
}