예제 #1
0
        public PageSpec(EntityTypeBuilder <Page> entityBuilder)
        {
            EntitySpec <Page> .SetEntitySpecs(entityBuilder);

            entityBuilder
            .Property(o => o.Title)
            .IsRequired()
            .HasMaxLength(250);

            entityBuilder
            .Property(o => o.Slug)
            .IsRequired()
            .HasMaxLength(100);

            entityBuilder
            .HasIndex(o => o.Slug)
            .IsUnique();

            entityBuilder
            .Property(o => o.Description)
            .HasMaxLength(2000);

            entityBuilder
            .HasOne(o => o.Owner)
            .WithMany(o => o.Pages)
            .OnDelete(DeleteBehavior.SetNull);

            entityBuilder
            .HasOne(o => o.Space)
            .WithMany(o => o.Pages)
            .OnDelete(DeleteBehavior.Cascade)
            .IsRequired();
        }
예제 #2
0
        public AppUserSpec(EntityTypeBuilder <AppUser> entityBuilder)
        {
            EntitySpec <AppUser> .SetEntitySpecs(entityBuilder);

            entityBuilder
            .HasIndex(o => o.UserName)
            .IsUnique();

            entityBuilder
            .Property(o => o.UserName)
            .IsRequired()
            .HasMaxLength(100);

            entityBuilder
            .Property(o => o.FirstName)
            .HasMaxLength(250);

            entityBuilder
            .Property(o => o.LastName)
            .HasMaxLength(250);

            entityBuilder
            .Property(o => o.Email)
            .HasMaxLength(250);

            entityBuilder
            .Property(o => o.Salt)
            .IsRequired();

            entityBuilder
            .Property(o => o.Password)
            .IsRequired();
        }