[CHANGE] Reworked entities and contexts
This commit is contained in:
@@ -7,11 +7,6 @@ namespace Manager.App;
|
|||||||
|
|
||||||
public static class DependencyInjection
|
public static class DependencyInjection
|
||||||
{
|
{
|
||||||
public static WebApplicationBuilder InjectDependencies(this WebApplicationBuilder builder)
|
|
||||||
{
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetupLogging(this WebApplicationBuilder builder)
|
public static void SetupLogging(this WebApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
var isDevelopment = builder.Environment.IsDevelopment();
|
var isDevelopment = builder.Environment.IsDevelopment();
|
||||||
|
@@ -21,8 +21,13 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Manager.Data\Manager.Data.csproj" />
|
||||||
<ProjectReference Include="..\Manager.Shared\Manager.Shared.csproj" />
|
<ProjectReference Include="..\Manager.Shared\Manager.Shared.csproj" />
|
||||||
<ProjectReference Include="..\Manager.YouTube\Manager.YouTube.csproj" />
|
<ProjectReference Include="..\Manager.YouTube\Manager.YouTube.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Services\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -10,6 +10,9 @@ builder.Services.AddRazorComponents()
|
|||||||
|
|
||||||
builder.SetupLogging();
|
builder.SetupLogging();
|
||||||
|
|
||||||
|
/* App setup */
|
||||||
|
|
||||||
|
|
||||||
/* MudBlazor */
|
/* MudBlazor */
|
||||||
builder.Services.AddMudServices();
|
builder.Services.AddMudServices();
|
||||||
|
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
using Manager.Data.Models.ApplicationContext;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace Manager.Data.Contexts;
|
|
||||||
|
|
||||||
public sealed class ApplicationDbContext : DbContext
|
|
||||||
{
|
|
||||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
||||||
ChangeTracker.LazyLoadingEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DbSet<SettingsGroupModel> SettingsGroups { get; set; }
|
|
||||||
public DbSet<SettingsModel> Settings { get; set; }
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<SettingsGroupModel>(sg =>
|
|
||||||
{
|
|
||||||
sg.ToTable("settings_groups");
|
|
||||||
sg.HasKey(x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<SettingsModel>(settingsEntity =>
|
|
||||||
{
|
|
||||||
settingsEntity.ToTable("settings");
|
|
||||||
settingsEntity.HasKey(x => x.Key);
|
|
||||||
});
|
|
||||||
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
using Manager.Data.Models.LibraryContext;
|
using Manager.Data.Entities.LibraryContext;
|
||||||
using Manager.Data.Models.LibraryContext.Join;
|
using Manager.Data.Entities.LibraryContext.Join;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Manager.Data.Contexts;
|
namespace Manager.Data.Contexts;
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
namespace Manager.Data;
|
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
namespace Manager.Data.Models;
|
namespace Manager.Data.Entities;
|
||||||
|
|
||||||
public abstract class DateTimeBase
|
public abstract class DateTimeBase
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class CaptionEntity
|
public class CaptionEntity
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class ChannelEntity : DateTimeBase
|
public class ChannelEntity : DateTimeBase
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class ClientAccountEntity : DateTimeBase
|
public class ClientAccountEntity : DateTimeBase
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class HttpCookieEntity : DateTimeBase
|
public class HttpCookieEntity : DateTimeBase
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext.Join;
|
namespace Manager.Data.Entities.LibraryContext.Join;
|
||||||
|
|
||||||
public class PlaylistMedia
|
public class PlaylistMedia
|
||||||
{
|
{
|
@@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Manager.Data.Models.LibraryContext.Join;
|
using Manager.Data.Entities.LibraryContext.Join;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class MediaEntity : DateTimeBase
|
public class MediaEntity : DateTimeBase
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class MediaFormatEntity
|
public class MediaFormatEntity
|
||||||
{
|
{
|
@@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Manager.Data.Models.LibraryContext.Join;
|
using Manager.Data.Entities.LibraryContext.Join;
|
||||||
|
|
||||||
namespace Manager.Data.Models.LibraryContext;
|
namespace Manager.Data.Entities.LibraryContext;
|
||||||
|
|
||||||
public class PlaylistEntity : DateTimeBase
|
public class PlaylistEntity : DateTimeBase
|
||||||
{
|
{
|
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Migrations\" />
|
<Folder Include="Migrations\" />
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
<Folder Include="Services\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
namespace Manager.Data.Models.ApplicationContext;
|
|
||||||
|
|
||||||
public record SettingsGroupModel
|
|
||||||
{
|
|
||||||
public required Guid Id { get; set; }
|
|
||||||
public required string Name { get; set; }
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Manager.Data.Models.ApplicationContext;
|
|
||||||
|
|
||||||
public class SettingsModel
|
|
||||||
{
|
|
||||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
|
||||||
public required string Key { get; set; }
|
|
||||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
|
||||||
public required string Name { get; set; }
|
|
||||||
[MaxLength(DataConstants.DbContext.DefaultDbDescriptionStringSize)]
|
|
||||||
public required string Description { get; set; }
|
|
||||||
public Guid? GroupId { get; set; }
|
|
||||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
|
||||||
public string ValueType { get; set; } = nameof(String);
|
|
||||||
public object? Value { get; set; }
|
|
||||||
public object? DefaultValue { get; set; }
|
|
||||||
}
|
|
Reference in New Issue
Block a user