Summary

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

History

Metrics

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

File(s)

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

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using ProjectX.Entities;
 3using ServiceBase;
 4
 5namespace ProjectX.Ef.Maps
 6{
 7    public static class ParticipationMap
 8    {
 9        /// <summary>
 10        /// Performs configuration of a <see cref="Participation"/> entity type
 11        /// in the model.
 12        /// </summary>
 13        /// <param name="modelBuilder">See <see cref="ModelBuilder"/></param>
 14        public static void MapParticipationEntity(
 15            this ModelBuilder modelBuilder)
 16        {
 317            modelBuilder.Entity<Participation>(entity =>
 318            {
 619                entity.ToTable(
 620                    Inflector.Pluralize(nameof(Participation).ToLower()));
 321
 622                entity.HasKey(x => new { x.UserId, x.EventId });
 323
 624                entity.Property(x => x.Kind);
 325
 626                entity.Property(x => x.CreatedAt);
 627                entity.Property(x => x.UpdatedAt);
 628                entity.Property(x => x.DeletedAt);
 329
 630                entity.HasOne(x => x.CreatedBy)
 631                  .WithMany()
 632                  .IsRequired(false)
 633                  .OnDelete(DeleteBehavior.SetNull)
 634                  .HasForeignKey(x => x.CreatedById);
 335
 636                entity.HasOne(x => x.UpdatedBy)
 637                  .WithMany()
 638                  .IsRequired(false)
 639                  .OnDelete(DeleteBehavior.SetNull)
 640                  .HasForeignKey(x => x.UpdatedById);
 341
 642                entity.HasOne(x => x.DeletedBy)
 643                  .WithMany()
 644                  .IsRequired(false)
 645                  .OnDelete(DeleteBehavior.SetNull)
 646                  .HasForeignKey(x => x.DeletedById);
 647            });
 348        }
 49    }
 50}