1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Furion.DatabaseAccessor;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- namespace YBEE.EQM.Core;
- /// <summary>
- /// 资源文件
- /// </summary>
- [Comment("资源文件")]
- public class ResourceFile : DEntityBase<long>, IEntityTypeBuilder<ResourceFile>
- {
- public ResourceFile()
- {
- Id = Yitter.IdGenerator.YitIdHelper.NextId();
- }
- /// <summary>
- /// 主键
- /// </summary>
- [Comment("主键")]
- [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
- public override long Id { get; set; }
- /// <summary>
- /// 资源文件类型
- /// </summary>
- [Comment("资源文件类型")]
- [Required]
- public ResourceFileType Type { get; set; }
- /// <summary>
- /// 来源ID
- /// </summary>
- [Comment("来源ID")]
- [Required]
- public long SourceId { get; set; }
- /// <summary>
- /// 文件名
- /// </summary>
- [Comment("文件名")]
- [Required, StringLength(100)]
- public string FileName { get; set; }
- /// <summary>
- /// 文件路径
- /// </summary>
- [Comment("文件路径")]
- [Required, StringLength(300)]
- public string FilePath { get; set; }
- /// <summary>
- /// 扩展名
- /// </summary>
- [Comment("扩展名")]
- [Required, StringLength(50)]
- public string FileExtName { get; set; }
- /// <summary>
- /// 文件大小(字节Byte)
- /// </summary>
- [Comment("文件大小(字节Byte)")]
- [Required]
- public long FileSize { get; set; } = 0;
- /// <summary>
- /// 备注
- /// </summary>
- [Comment("备注")]
- [StringLength(200)]
- public string Remark { get; set; } = "";
- public void Configure(EntityTypeBuilder<ResourceFile> entityBuilder, DbContext dbContext, Type dbContextLocator)
- {
- entityBuilder.HasIndex(a => new { a.Type, a.SourceId }).HasDatabaseName("idx_resource_file_type_source_id");
- }
- }
|