0
hitaspdotnet created
Hi, How you can mapping your entities from different assemblies? I have a entity in a class library named ShopModule with a entity named Customer. I want make OTO relation between Customers and AbpUser. A user can be a Customer that not required for all users. But a customer must be a User. I am a beginner and my attempt to create this relationship is confused cycle reference driving between assemblies.
1 Answer(s)
-
0
Use Fluent API for one-to-one relationships:
modelBuilder.Entity<Customer>() .HasOne(c => c.User) .WithOne() .HasForeignKey<Customer>(c => c.UserId) .OnDelete(DeleteBehavior.Cascade);