63 lines
1.3 KiB
C#
63 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace ChatRoomServer.Db.Entities
|
|
{
|
|
/// <summary>
|
|
///系统公告
|
|
///</summary>
|
|
public class Announcement
|
|
{
|
|
/// <summary>
|
|
/// 公告ID
|
|
/// </summary>
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标题
|
|
/// </summary>
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// 公告内容
|
|
/// </summary>
|
|
public string Content { get; set; }
|
|
|
|
/// <summary>
|
|
/// 发布时间
|
|
/// </summary>
|
|
public DateTime PubTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否是关键公告
|
|
/// </summary>
|
|
public bool Important { get; set; }
|
|
|
|
/// <summary>
|
|
/// 过期时间
|
|
/// </summary>
|
|
public DateTime ExpiresTime { get; set; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实体类 <see cref="Announcement" /> 的配置对象
|
|
/// </summary>
|
|
internal class AnnouncementConfiguration : EntityTypeConfiguration<Announcement>
|
|
{
|
|
public AnnouncementConfiguration()
|
|
{
|
|
ToTable("Chat_Announcement");
|
|
HasKey(m => m.Id);
|
|
Property(s => s.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
|
|
Property(s => s.Title).HasMaxLength(100).IsRequired();
|
|
Property(s => s.Content).HasMaxLength(1000).IsRequired();
|
|
}
|
|
}
|
|
}
|