model changes
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model.Account;
|
||||
using WatchIt.Database.Model.Genre;
|
||||
using WatchIt.Database.Model.Common;
|
||||
|
||||
namespace WatchIt.Database.Model.Media
|
||||
{
|
||||
@@ -28,9 +28,11 @@ namespace WatchIt.Database.Model.Media
|
||||
#region NAVIGATION
|
||||
|
||||
public MediaPosterImage? MediaPosterImage { get; set; }
|
||||
public ICollection<MediaPhotoImage> MediaPhotoImages { get; set; }
|
||||
public ICollection<GenreMedia> GenreMedia { get; set; }
|
||||
public ICollection<Genre.Genre> Genres { get; set; }
|
||||
public IEnumerable<MediaPhotoImage> MediaPhotoImages { get; set; }
|
||||
public IEnumerable<MediaGenre> MediaGenres { get; set; }
|
||||
public IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; }
|
||||
public IEnumerable<Genre> Genres { get; set; }
|
||||
public IEnumerable<Country> ProductionCountries { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -68,7 +70,10 @@ namespace WatchIt.Database.Model.Media
|
||||
// Navigation
|
||||
builder.HasMany(x => x.Genres)
|
||||
.WithMany(x => x.Media)
|
||||
.UsingEntity<GenreMedia>();
|
||||
.UsingEntity<MediaGenre>();
|
||||
builder.HasMany(x => x.ProductionCountries)
|
||||
.WithMany(x => x.MediaProduction)
|
||||
.UsingEntity<MediaProductionCountry>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
52
WatchIt.Database/WatchIt.Database.Model/Media/MediaGenre.cs
Normal file
52
WatchIt.Database/WatchIt.Database.Model/Media/MediaGenre.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model.Common;
|
||||
|
||||
namespace WatchIt.Database.Model.Media
|
||||
{
|
||||
public class MediaGenre : IEntity<MediaGenre>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public long MediaId { get; set; }
|
||||
public short GenreId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public Media Media { get; set; }
|
||||
public Genre Genre { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<MediaGenre>.Build(EntityTypeBuilder<MediaGenre> builder)
|
||||
{
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.MediaGenres)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Genre)
|
||||
.WithMany(x => x.MediaGenres)
|
||||
.HasForeignKey(x => x.GenreId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.GenreId)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model.Common;
|
||||
|
||||
namespace WatchIt.Database.Model.Media
|
||||
{
|
||||
public class MediaProductionCountry : IEntity<MediaProductionCountry>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public long MediaId { get; set; }
|
||||
public short CountryId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public Media Media { get; set; }
|
||||
public Country Country { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<MediaProductionCountry>.Build(EntityTypeBuilder<MediaProductionCountry> builder)
|
||||
{
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.MediaProductionCountries)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Country)
|
||||
.WithMany(x => x.MediaProductionCountries)
|
||||
.HasForeignKey(x => x.CountryId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.CountryId)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace WatchIt.Database.Model.Media
|
||||
#region NAVIGATION
|
||||
|
||||
public Media Media { get; set; }
|
||||
public ICollection<MediaSeriesSeason> MediaSeriesSeasons { get; set; }
|
||||
public IEnumerable<MediaSeriesSeason> MediaSeriesSeasons { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace WatchIt.Database.Model.Media
|
||||
#region NAVIGATION
|
||||
|
||||
public MediaSeries MediaSeries { get; set; }
|
||||
public ICollection<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
||||
public IEnumerable<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user