UserAvatarMap.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.ComponentModel.DataAnnotations.Schema;
  2. using System.Data.Entity.ModelConfiguration;
  3. namespace YZXYH.Repository.Models.Mapping
  4. {
  5. public class UserAvatarMap : EntityTypeConfiguration<UserAvatar>
  6. {
  7. public UserAvatarMap()
  8. {
  9. // Primary Key
  10. this.HasKey(t => t.Id);
  11. // Properties
  12. this.Property(t => t.Id)
  13. .IsRequired()
  14. .HasMaxLength(50);
  15. this.Property(t => t.UserNo)
  16. .IsRequired()
  17. .HasMaxLength(50);
  18. this.Property(t => t.FileName)
  19. .HasMaxLength(50);
  20. this.Property(t => t.FilePath)
  21. .IsRequired()
  22. .HasMaxLength(500);
  23. this.Property(t => t.FileType)
  24. .HasMaxLength(20);
  25. this.Property(t => t.FileNo)
  26. .HasMaxLength(30);
  27. this.Property(t => t.IsLocked)
  28. .IsRequired()
  29. .IsFixedLength()
  30. .HasMaxLength(1);
  31. // Table & Column Mappings
  32. this.ToTable("UserAvatars");
  33. this.Property(t => t.Id).HasColumnName("Id");
  34. this.Property(t => t.UserNo).HasColumnName("UserNo");
  35. this.Property(t => t.FileName).HasColumnName("FileName");
  36. this.Property(t => t.FilePath).HasColumnName("FilePath");
  37. this.Property(t => t.FileType).HasColumnName("FileType");
  38. this.Property(t => t.FileNo).HasColumnName("FileNo");
  39. this.Property(t => t.IsLocked).HasColumnName("IsLocked");
  40. this.Property(t => t.TimeCreate).HasColumnName("TimeCreate");
  41. this.Property(t => t.Remark).HasColumnName("Remark");
  42. }
  43. }
  44. }