| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
- using Microsoft.EntityFrameworkCore;
- namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
- {
- public class TenantUserDm : KeylessDm<TenantUser>
- {
- public override void Map(ModelBuilder builder)
- {
- if (builder == null) throw new ArgumentNullException(nameof(builder));
- base.Map(builder);
- builder.Entity<TenantUser>(entity =>
- {
- entity.ToTable(Constants.Modules.Base.TblTenantUser, Constants.Modules.Base.Schema);
- // foreign keys
- entity.Property(e => e.TenantId).IsRequired()
- .HasComment("Reference to tenant that setting belongs");
- entity.Property(e => e.UserId).IsRequired()
- .HasComment("Reference to user assigned to tenant");
- // relationships
- entity.HasOne(d => d.Tenant)
- .WithMany()
- .HasForeignKey(d => d.TenantId)
- .HasConstraintName("REL_TENANTUSER_TENANT_ID");
- entity.HasOne(d => d.User)
- .WithMany()
- .HasForeignKey(d => d.UserId)
- .HasConstraintName("REL_TENANTUSER_USER_ID");
- }
- );
- }
- }
- }
|