Light12306/ChatRoomServer.Db/Entities/User.cs
2015-07-08 17:24:45 +08:00

70 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 User
{
/// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; }
public DateTime FirstConnect { get; set; }
public DateTime LastConnect { get; set; }
public int OnlineTime { get; set; }
/// <summary>
/// 第一次发送信息时间
/// </summary>
public DateTime? FirstSend { get; set; }
/// <summary>
/// 最后一次发送信息时间
/// </summary>
public DateTime? LastSend { get; set; }
/// <summary>
/// 发送信息次数
/// </summary>
public int SendTimes { get; set; }
/// <summary>
/// 状态0-正常2-已封禁
/// </summary>
public UserStatus Status { get; set; }
public string NickName { get; set; }
}
public enum UserStatus
{
Normal = 0,
Blocked = 2
}
/// <summary>
/// 实体类 <see cref="User" /> 的配置对象
/// </summary>
internal class UserConfiguration : EntityTypeConfiguration<User>
{
public UserConfiguration()
{
ToTable("Chat_User");
HasKey(m => m.UserName);
Property(s => s.UserName).HasMaxLength(100).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
}
}
}