| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.EntityFrameworkCore;
- using Quadarax.Application.QLiberace.Base;
- namespace Quadarax.Application.QLiberace.Customer.Entities.DaoMapper
- {
- internal class CustomerUserDm : KeylessDm<CustomerUser>
- {
- public override void Map(ModelBuilder builder)
- {
- if (builder == null) throw new ArgumentNullException(nameof(builder));
- base.Map(builder);
- builder.Entity<CustomerUser>(entity =>
- {
- entity.ToTable(Constants.Modules.Customer.TblCustomerUser, Constants.Modules.Customer.Schema);
- entity.HasKey(tu => new { tu.CustomerId, tu.UserLoginName });
- entity.Property(e => e.CustomerId).IsRequired()
- .HasComment("Reference to customer");
- entity.Property(e => e.UserLoginName).IsRequired()
- .HasMaxLength(100)
- .HasComment("Reference to user");
-
- // relationships
- entity.HasOne(pc => pc.Customer)
- .WithMany(p => p.Users)
- .HasForeignKey(pc => pc.CustomerId)
- .OnDelete(DeleteBehavior.NoAction)
- .HasConstraintName("REL_CUSTOMERUSER_CUSTOMER_ID");
-
- }
- );
- }
- }
- }
|