初始提交
This commit is contained in:
21
Services/Hncore.Pass.OSS/Domain/Asset.cs
Normal file
21
Services/Hncore.Pass.OSS/Domain/Asset.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hncore.Pass.OSS.Domain
|
||||
{
|
||||
public partial class Asset : EntityWithDelete<int>, ITenant
|
||||
{
|
||||
public int TenantId { get; set; }
|
||||
public int? GroupId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int AssetType { get; set; }
|
||||
public string Image { get; set; }
|
||||
public string BaseUrl { get; set; }
|
||||
public string Path { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
public string Url { get => BaseUrl.Has() ? $"{BaseUrl}/{Path}" : Path; }
|
||||
}
|
||||
}
|
||||
14
Services/Hncore.Pass.OSS/Domain/AssetGroup.cs
Normal file
14
Services/Hncore.Pass.OSS/Domain/AssetGroup.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hncore.Pass.OSS.Domain
|
||||
{
|
||||
public partial class AssetGroup : EntityWithDelete<int>, ITenant
|
||||
{
|
||||
public int TenantId { get; set; }
|
||||
public int? GroupType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
45
Services/Hncore.Pass.OSS/Domain/CourseContext.cs
Normal file
45
Services/Hncore.Pass.OSS/Domain/CourseContext.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.OSS.Domain
|
||||
{
|
||||
public partial class CourseContext : DbContextBase
|
||||
{
|
||||
IHttpContextAccessor _httpContextAccessor;
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="options">上下文实体</param>
|
||||
/// <param name="httpContextAccessor">http请求上下文</param>
|
||||
public CourseContext(DbContextOptions<CourseContext> options, IHttpContextAccessor httpContextAccessor) :
|
||||
base(options, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public virtual DbSet<Asset> Asset { get; set; }
|
||||
public virtual DbSet<AssetGroup> AssetGroup { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Asset>(entity =>
|
||||
{
|
||||
entity.ToTable("asset");
|
||||
entity.HasKey(p => p.Id);
|
||||
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AssetGroup>(entity =>
|
||||
{
|
||||
entity.ToTable("asset_group");
|
||||
entity.HasKey(p => p.Id);
|
||||
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
|
||||
});
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user