You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.6 KiB
40 lines
1.6 KiB
using Application.Domain.Entities;
|
|
using IoT.UI.Shard;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace MediaService
|
|
{
|
|
public class Startup : ShardStartup
|
|
{
|
|
public Startup(IConfiguration configuration, IHostingEnvironment env) : base(configuration, env)
|
|
{
|
|
}
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
base.ConfigureServices(services);
|
|
}
|
|
|
|
public override void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
|
{
|
|
base.Configure(app, env, loggerFactory);
|
|
}
|
|
|
|
public override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.Entity<FolderObject>().HasOne(o => o.Parent).WithMany(o => o.Children).HasForeignKey(o => o.ParentId);
|
|
modelBuilder.Entity<FolderObject>().Property(o => o.Name).IsRequired();
|
|
modelBuilder.Entity<FolderObject>().Property(o => o.Path).IsRequired();
|
|
modelBuilder.Entity<FolderObject>().HasIndex(o => new { o.ParentId, o.Name }).IsUnique();
|
|
modelBuilder.Entity<FileObject>().Property(o => o.Name).IsRequired();
|
|
modelBuilder.Entity<FileObject>().Property(o => o.Path).IsRequired();
|
|
modelBuilder.Entity<FileObject>().HasIndex(o => new { o.FolderId, o.Name }).IsUnique();
|
|
}
|
|
}
|
|
} |