Summary

Class:ProjectX.Ef.Maps.UserImageMap
Assembly:ProjectX.Ef
File(s):C:\private\projects\projectx\backend\src\ProjectX.Ef\Maps\UserPhotoMap.cs
Covered lines:35
Uncovered lines:0
Coverable lines:35
Total lines:52
Line coverage:100%

History

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
MapUserImageEntity(...)20100100

File(s)

C:\private\projects\projectx\backend\src\ProjectX.Ef\Maps\UserPhotoMap.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using ProjectX.Entities;
 3using ServiceBase;
 4
 5namespace ProjectX.Ef.Maps
 6{
 7    public static class UserImageMap
 8    {
 9        /// <summary>
 10        /// Performs configuration of a <see cref="UserImage"/> entity type in
 11        /// the model.
 12        /// </summary>
 13        /// <param name="modelBuilder">See <see cref="ModelBuilder"/></param>
 14        public static void MapUserImageEntity(this ModelBuilder modelBuilder)
 15        {
 316            modelBuilder.Entity<UserImage>(entity =>
 317            {
 618                entity.ToTable(Inflector
 619                    .Pluralize(nameof(UserImage).ToLower()));
 320
 621                entity.HasKey(x => x.ImageId);
 322
 623                entity.Property(x => x.CreatedAt);
 624                entity.Property(x => x.UpdatedAt);
 625                entity.Property(x => x.DeletedAt);
 326
 627                entity.HasOne(x => x.User)
 628                    .WithMany(x => x.Images)
 629                    .OnDelete(DeleteBehavior.SetNull)
 630                    .HasForeignKey(x => x.UserId);
 331
 632                entity.HasOne(x => x.CreatedBy)
 633                  .WithMany()
 634                  .IsRequired(false)
 635                  .OnDelete(DeleteBehavior.SetNull)
 636                  .HasForeignKey(x => x.CreatedById);
 337
 638                entity.HasOne(x => x.UpdatedBy)
 639                  .WithMany()
 640                  .IsRequired(false)
 641                  .OnDelete(DeleteBehavior.SetNull)
 642                  .HasForeignKey(x => x.UpdatedById);
 343
 644                entity.HasOne(x => x.DeletedBy)
 645                  .WithMany()
 646                  .IsRequired(false)
 647                  .OnDelete(DeleteBehavior.SetNull)
 648                  .HasForeignKey(x => x.DeletedById);
 649            });
 350        }
 51    }
 52}