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 MsgLog { /// /// ID /// public long Id { get; set; } /// /// 用户名 /// public string UserName { get; set; } /// /// 发送时间 /// public DateTime SendTime { get; set; } /// /// 发送内容 /// public string Content { get; set; } /// /// IP /// public string Ip { get; set; } /// /// RoomID /// public string RoomId { get; set; } public string Image { get; set; } public string Color { get; set; } public string AtUser { get; set; } } /// /// 实体类 的配置对象 /// internal class MsgLogConfiguration : EntityTypeConfiguration { public MsgLogConfiguration() { ToTable("Chat_MsgLog"); HasKey(m => m.Id); Property(s => s.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); Property(s => s.UserName).HasMaxLength(100).IsRequired(); Property(s => s.Content).HasMaxLength(800).IsRequired(); Property(s => s.Ip).HasMaxLength(100).IsRequired(); Property(s => s.RoomId).HasMaxLength(100).IsRequired(); } } }