47 lines
1.1 KiB
C#
47 lines
1.1 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 OnlineHistory
|
|
{
|
|
/// <summary>
|
|
/// 时间
|
|
/// </summary>
|
|
public DateTime Time { get; set; }
|
|
|
|
/// <summary>
|
|
/// 房间ID
|
|
/// </summary>
|
|
public string RoomID { get; set; }
|
|
|
|
/// <summary>
|
|
/// 在线人数
|
|
/// </summary>
|
|
public int OnlineCount { get; set; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实体类 <see cref="OnlineHistory" /> 的配置对象
|
|
/// </summary>
|
|
internal class OnlineHistoryConfiguration : EntityTypeConfiguration<OnlineHistory>
|
|
{
|
|
public OnlineHistoryConfiguration()
|
|
{
|
|
ToTable("Chat_OnlineHistory");
|
|
HasKey(m => new { m.Time, m.RoomID });
|
|
Property(s => s.Time).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
|
|
Property(s => s.RoomID).HasMaxLength(50).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
|
|
}
|
|
}
|
|
}
|