Summary

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

History

Metrics

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

File(s)

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

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using ProjectX.Entities;
 3using ServiceBase;
 4
 5namespace ProjectX.Ef.Maps
 6{
 7    public static class EventCategoryMap
 8    {
 9        /// <summary>
 10        /// Performs configuration of a <see cref="EventCategory"/> entity type
 11        /// in the model.
 12        /// </summary>
 13        /// <param name="modelBuilder">See <see cref="ModelBuilder"/></param>
 14        public static void MapEventCategoryEntity(
 15            this ModelBuilder modelBuilder)
 16        {
 317            modelBuilder.Entity<EventCategory>(entity =>
 318            {
 619                entity.ToTable(Inflector
 620                    .Pluralize(nameof(EventCategory).ToLower()));
 321
 622                entity.HasKey(x => x.Id);
 323
 624                entity.Property(x => x.Title).HasMaxLength(100);
 625                entity.Property(x => x.Info).HasMaxLength(512);
 326
 627                entity.Property(x => x.CreatedAt);
 628                entity.Property(x => x.UpdatedAt);
 629                entity.Property(x => x.DeletedAt);
 330
 631                entity.HasOne(x => x.CreatedBy)
 632                  .WithMany()
 633                  .IsRequired(false)
 634                  .OnDelete(DeleteBehavior.SetNull)
 635                  .HasForeignKey(x => x.CreatedById);
 336
 637                entity.HasOne(x => x.UpdatedBy)
 638                  .WithMany()
 639                  .IsRequired(false)
 640                  .OnDelete(DeleteBehavior.SetNull)
 641                  .HasForeignKey(x => x.UpdatedById);
 342
 643                entity.HasOne(x => x.DeletedBy)
 644                  .WithMany()
 645                  .IsRequired(false)
 646                  .OnDelete(DeleteBehavior.SetNull)
 647                  .HasForeignKey(x => x.DeletedById);
 648            });
 349        }
 50    }
 51}