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 { /// /// /// public class Room { /// /// 房间ID /// public string ID { get; set; } /// /// 大区名称 /// public string Name { get; set; } /// /// 分类 /// public int Category { get; set; } /// /// 服务器分组 /// public int ServerGroup { get; set; } /// /// 推荐状态 /// public bool Recommand { get; set; } /// /// 是否可用 /// public bool Status { get; set; } /// /// 在线数 /// public int OnlineCount { get; set; } } /// /// 实体类 的配置对象 /// internal class RoomConfiguration : EntityTypeConfiguration { public RoomConfiguration() { ToTable("Chat_Room"); HasKey(m => m.ID); Property(s => s.ID).HasMaxLength(50).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None); Property(s => s.Name).HasMaxLength(200).IsRequired(); Ignore(s => s.OnlineCount); } } }