63 lines
1.4 KiB
C#
63 lines
1.4 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 UserConnectLog
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 记录ID
|
|||
|
/// </summary>
|
|||
|
public long Id { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 用户ID
|
|||
|
/// </summary>
|
|||
|
public string UserName { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 房间ID
|
|||
|
/// </summary>
|
|||
|
public string RoomID { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 连接时间
|
|||
|
/// </summary>
|
|||
|
public DateTime ConnectTime { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 断开时间
|
|||
|
/// </summary>
|
|||
|
public DateTime? DisconnectTime { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 连接的时间(秒)
|
|||
|
/// </summary>
|
|||
|
public int? ElapsedTime { get; set; }
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 实体类 <see cref="UserConnectLog" /> 的配置对象
|
|||
|
/// </summary>
|
|||
|
internal class UserConnectLogConfiguration : EntityTypeConfiguration<UserConnectLog>
|
|||
|
{
|
|||
|
public UserConnectLogConfiguration()
|
|||
|
{
|
|||
|
ToTable("Chat_UserConnectLog");
|
|||
|
HasKey(m => m.Id);
|
|||
|
Property(s => s.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
|
|||
|
Property(s => s.UserName).HasMaxLength(100).IsRequired();
|
|||
|
Property(s => s.RoomID).HasMaxLength(100).IsRequired();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|