public PostMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Slug) .IsRequired() .HasMaxLength(255); this.Property(t => t.Author) .IsRequired() .HasMaxLength(50); this.Property(t => t.Title) .IsRequired() .HasMaxLength(255); this.Property(t => t.Content) .IsRequired(); this.Property(t => t.Excerpt) .IsRequired() .HasMaxLength(255); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Post")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Slug).HasColumnName(MicuaContext.GetColumnName("Slug")); this.Property(t => t.Author).HasColumnName(MicuaContext.GetColumnName("Author")); this.Property(t => t.Title).HasColumnName(MicuaContext.GetColumnName("Title")); this.Property(t => t.Published).HasColumnName(MicuaContext.GetColumnName("Published")); this.Property(t => t.Modified).HasColumnName(MicuaContext.GetColumnName("Modified")); this.Property(t => t.Content).HasColumnName(MicuaContext.GetColumnName("Content")); this.Property(t => t.Excerpt).HasColumnName(MicuaContext.GetColumnName("Excerpt")); this.Property(t => t.Type).HasColumnName(MicuaContext.GetColumnName("Type")); this.Property(t => t.Status).HasColumnName(MicuaContext.GetColumnName("Status")); this.Property(t => t.CommentStatus).HasColumnName(MicuaContext.GetColumnName("CommentStatus")); this.Property(t => t.PingStatus).HasColumnName(MicuaContext.GetColumnName("PingStatus")); this.Property(t => t.Sort).HasColumnName(MicuaContext.GetColumnName("Sort")); this.Property(t => t.ViewCount).HasColumnName(MicuaContext.GetColumnName("ViewCount")); this.Property(t => t.CommentCount).HasColumnName(MicuaContext.GetColumnName("CommentCount")); this.Property(t => t.UserId).HasColumnName(MicuaContext.GetColumnName("UserId")); this.Property(t => t.BlogId).HasColumnName(MicuaContext.GetColumnName("BlogId")); this.Property(t => t.ParentId).HasColumnName(MicuaContext.GetColumnName("ParentId")).IsOptional(); // Relationships this.HasRequired(t => t.Blog) .WithMany(t => t.Posts) .HasForeignKey(d => d.BlogId) .WillCascadeOnDelete(false); this.HasOptional(t => t.Parent) .WithMany(t => t.Children) .HasForeignKey(d => d.ParentId) .WillCascadeOnDelete(false); this.HasRequired(t => t.User) .WithMany(t => t.Posts) .HasForeignKey(d => d.UserId) .WillCascadeOnDelete(false); }
public PostMetaMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Key) .IsRequired() .IsUnicode(false) .HasMaxLength(50); this.Property(t => t.Value) .IsRequired(); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("PostMeta")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.PostId).HasColumnName(MicuaContext.GetColumnName("PostId")); this.Property(t => t.Key).HasColumnName(MicuaContext.GetColumnName("Key")); this.Property(t => t.Value).HasColumnName(MicuaContext.GetColumnName("Value")); // Relationships this.HasRequired(t => t.Post) .WithMany(t => t.PostMetas) .HasForeignKey(d => d.PostId) .WillCascadeOnDelete(false); }
public BlogMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Slug) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Name) .IsRequired() .HasMaxLength(50); this.Property(t => t.SubName) .IsRequired() .HasMaxLength(255); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Blog")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Slug).HasColumnName(MicuaContext.GetColumnName("Slug")); this.Property(t => t.Name).HasColumnName(MicuaContext.GetColumnName("Name")); this.Property(t => t.SubName).HasColumnName(MicuaContext.GetColumnName("SubName")); this.Property(t => t.Created).HasColumnName(MicuaContext.GetColumnName("Created")); this.Property(t => t.Status).HasColumnName(MicuaContext.GetColumnName("Status")); this.Property(t => t.UserId).HasColumnName(MicuaContext.GetColumnName("UserId")); // Relationships this.HasRequired(t => t.User) .WithMany(t => t.Blogs) .HasForeignKey(d => d.UserId) .WillCascadeOnDelete(false); }
public LinkMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Name) .IsRequired() .HasMaxLength(50); this.Property(t => t.Url) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Image) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Title) .IsRequired() .HasMaxLength(255); this.Property(t => t.Target) .IsRequired() .IsUnicode(false) .HasMaxLength(20); this.Property(t => t.Relation) .IsRequired() .IsUnicode(false) .HasMaxLength(20); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Link")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Name).HasColumnName(MicuaContext.GetColumnName("Name")); this.Property(t => t.Url).HasColumnName(MicuaContext.GetColumnName("Url")); this.Property(t => t.Image).HasColumnName(MicuaContext.GetColumnName("Image")); this.Property(t => t.Title).HasColumnName(MicuaContext.GetColumnName("Title")); this.Property(t => t.Target).HasColumnName(MicuaContext.GetColumnName("Target")); this.Property(t => t.Relation).HasColumnName(MicuaContext.GetColumnName("Relation")); this.Property(t => t.Type).HasColumnName(MicuaContext.GetColumnName("Type")); this.Property(t => t.Visible).HasColumnName(MicuaContext.GetColumnName("Visible")); this.Property(t => t.Modified).HasColumnName(MicuaContext.GetColumnName("Modified")); this.Property(t => t.Sort).HasColumnName(MicuaContext.GetColumnName("Sort")); this.Property(t => t.BlogId).HasColumnName(MicuaContext.GetColumnName("BlogId")); this.Property(t => t.ParentId).HasColumnName(MicuaContext.GetColumnName("ParentId")); // Relationships this.HasRequired(t => t.Blog) .WithMany(t => t.Links) .HasForeignKey(d => d.BlogId) .WillCascadeOnDelete(false); this.HasRequired(t => t.Parent) .WithMany(t => t.Children) .HasForeignKey(d => d.ParentId) .WillCascadeOnDelete(false); }
public UserMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Login) .IsRequired() .IsUnicode(false) .HasMaxLength(50); this.Property(t => t.Password) .IsRequired() .IsUnicode(false) .HasMaxLength(64); this.Property(t => t.Nickname) .IsRequired() .HasMaxLength(30); this.Property(t => t.Mobile) .IsRequired() .IsUnicode(false) .HasMaxLength(20); this.Property(t => t.Email) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Link) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Introduce) .IsRequired(); this.Property(t => t.Token) .IsRequired() .IsUnicode(false) .HasMaxLength(64); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("User")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Login).HasColumnName(MicuaContext.GetColumnName("Login")); this.Property(t => t.Password).HasColumnName(MicuaContext.GetColumnName("Password")); this.Property(t => t.Nickname).HasColumnName(MicuaContext.GetColumnName("Nickname")); this.Property(t => t.Mobile).HasColumnName(MicuaContext.GetColumnName("Mobile")); this.Property(t => t.Email).HasColumnName(MicuaContext.GetColumnName("Email")); this.Property(t => t.Link).HasColumnName(MicuaContext.GetColumnName("Link")); this.Property(t => t.Introduce).HasColumnName(MicuaContext.GetColumnName("Introduce")); this.Property(t => t.Role).HasColumnName(MicuaContext.GetColumnName("Role")); this.Property(t => t.Status).HasColumnName(MicuaContext.GetColumnName("Status")); this.Property(t => t.Registered).HasColumnName(MicuaContext.GetColumnName("Registered")); this.Property(t => t.Token).HasColumnName(MicuaContext.GetColumnName("Token")); }
public CommentMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Author) .IsRequired() .HasMaxLength(50); this.Property(t => t.Email) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Link) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Content) .IsRequired(); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Comment")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Author).HasColumnName(MicuaContext.GetColumnName("Author")); this.Property(t => t.Email).HasColumnName(MicuaContext.GetColumnName("Email")); this.Property(t => t.Link).HasColumnName(MicuaContext.GetColumnName("Link")); this.Property(t => t.Commented).HasColumnName(MicuaContext.GetColumnName("Commented")); this.Property(t => t.Content).HasColumnName(MicuaContext.GetColumnName("Content")); this.Property(t => t.Status).HasColumnName(MicuaContext.GetColumnName("Status")); this.Property(t => t.UserId).HasColumnName(MicuaContext.GetColumnName("UserId")); this.Property(t => t.BlogId).HasColumnName(MicuaContext.GetColumnName("BlogId")); this.Property(t => t.PostId).HasColumnName(MicuaContext.GetColumnName("PostId")); this.Property(t => t.ParentId).HasColumnName(MicuaContext.GetColumnName("ParentId")).IsOptional(); // Relationships this.HasRequired(t => t.Blog) .WithMany(t => t.Comments) .HasForeignKey(d => d.BlogId) .WillCascadeOnDelete(false); this.HasOptional(t => t.Parent) .WithMany(t => t.Children) .HasForeignKey(d => d.ParentId) .WillCascadeOnDelete(false); this.HasRequired(t => t.Post) .WithMany(t => t.Comments) .HasForeignKey(d => d.PostId) .WillCascadeOnDelete(false); this.HasRequired(t => t.User) .WithMany(t => t.Comments) .HasForeignKey(d => d.UserId) .WillCascadeOnDelete(false); }
public OptionMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Name) .IsRequired() .IsUnicode(false) .HasMaxLength(50); this.Property(t => t.Value) .IsRequired(); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Option")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Name).HasColumnName(MicuaContext.GetColumnName("Name")); this.Property(t => t.Value).HasColumnName(MicuaContext.GetColumnName("Value")); this.Property(t => t.Enabled).HasColumnName(MicuaContext.GetColumnName("Enabled")); }
public TermRelationMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("TermRelation")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.ObjectId).HasColumnName(MicuaContext.GetColumnName("ObjectId")); this.Property(t => t.Type).HasColumnName(MicuaContext.GetColumnName("Type")); this.Property(t => t.TermId).HasColumnName(MicuaContext.GetColumnName("TermId")); this.Property(t => t.Sort).HasColumnName(MicuaContext.GetColumnName("Sort")); // Relationships this.HasRequired(t => t.Term) .WithMany(t => t.Relations) .HasForeignKey(d => d.TermId) .WillCascadeOnDelete(false); }
public TermMap() { // Primary Key this.HasKey(t => t.Id); // Properties this.Property(t => t.Slug) .IsRequired() .IsUnicode(false) .HasMaxLength(255); this.Property(t => t.Name) .IsRequired() .IsUnicode(false) .HasMaxLength(50); this.Property(t => t.Description) .IsRequired() .HasMaxLength(255); // Table & Column Mappings this.ToTable(MicuaContext.GetTableName("Term")); this.Property(t => t.Id).HasColumnName(MicuaContext.GetColumnName("Id")); this.Property(t => t.Slug).HasColumnName(MicuaContext.GetColumnName("Slug")); this.Property(t => t.Name).HasColumnName(MicuaContext.GetColumnName("Name")); this.Property(t => t.Description).HasColumnName(MicuaContext.GetColumnName("Description")); this.Property(t => t.Type).HasColumnName(MicuaContext.GetColumnName("Type")); this.Property(t => t.Sort).HasColumnName(MicuaContext.GetColumnName("Sort")); this.Property(t => t.Count).HasColumnName(MicuaContext.GetColumnName("Count")); this.Property(t => t.ParentId).HasColumnName(MicuaContext.GetColumnName("ParentId")).IsOptional(); // Relationships this.HasOptional(t => t.Parent) .WithMany(t => t.Children) .HasForeignKey(d => d.ParentId) .WillCascadeOnDelete(false); }