Updated more models
This commit is contained in:
@@ -46,7 +46,7 @@ public class ArtistController : BaseController
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public IActionResult GetArtist(int id)
|
||||
public IActionResult GetArtist(Guid id)
|
||||
{
|
||||
Artist artist = new Artist { Id = id };
|
||||
|
||||
|
||||
@@ -30,6 +30,14 @@ public class AccessLevelContext : DbContext
|
||||
{
|
||||
modelBuilder.Entity<Models.AccessLevel>().ToTable("AccessLevel");
|
||||
|
||||
modelBuilder.Entity<Models.AccessLevel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Models.AccessLevel>().Property(m => m.Level).IsRequired(true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -18,6 +18,14 @@ public class AlbumContext : DbContext
|
||||
{
|
||||
modelBuilder.Entity<Album>()
|
||||
.ToTable("Album");
|
||||
|
||||
modelBuilder.Entity<Album>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
}
|
||||
|
||||
public Album RetrieveRecord(Album album)
|
||||
|
||||
@@ -18,6 +18,14 @@ public class ArtistContext : DbContext
|
||||
{
|
||||
modelBuilder.Entity<Artist>()
|
||||
.ToTable("Artist");
|
||||
|
||||
modelBuilder.Entity<Artist>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
}
|
||||
|
||||
public Artist RetrieveRecord(Artist artist)
|
||||
|
||||
@@ -20,6 +20,13 @@ public class CoverArtContext : DbContext
|
||||
{
|
||||
modelBuilder.Entity<CoverArt>()
|
||||
.ToTable("CoverArt");
|
||||
modelBuilder.Entity<CoverArt>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
}
|
||||
|
||||
public CoverArt RetrieveRecord(CoverArt cover)
|
||||
|
||||
@@ -20,6 +20,14 @@ public class GenreContext : DbContext
|
||||
{
|
||||
modelBuilder.Entity<Genre>()
|
||||
.ToTable("Genre");
|
||||
|
||||
modelBuilder.Entity<Genre>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@ public class SongContext : DbContext
|
||||
modelBuilder.Entity<Song>()
|
||||
.ToTable("Song");
|
||||
|
||||
modelBuilder.Entity<Song>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Song>()
|
||||
.Property(s => s.Year)
|
||||
.IsRequired(false);
|
||||
|
||||
@@ -25,12 +25,12 @@ public class UserContext : DbContext
|
||||
.ToTable("User");
|
||||
|
||||
modelBuilder.Entity<User>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)"); // **** Map Guid to BINARY(16) ****
|
||||
});
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("binary(16)"); // **** Map Guid to BINARY(16) ****
|
||||
});
|
||||
modelBuilder.Entity<User>()
|
||||
.Property(u => u.LastLogin).IsRequired(false);
|
||||
modelBuilder.Entity<User>()
|
||||
|
||||
Reference in New Issue
Block a user