'Using Identity 4 and Aggregate root (DDD) at the same time

I'm refactoring my project in CQRS and DDD, and I wanted to use Microsoft Identity 4.

So in aggregate root implementations we'll gonna have Entities inheriting from an abstract class called Entity and the aggregates are gonna inherit from an interface called IAggregate which defines the aggregate model in the aggregate root (As explained in Microsoft docs).

Here is the question:

In order to tell the identity what are your Identity classes your classes should inherit the identity classes provided by the Identity (such as IdentityUser<TKey>). In case of having an aggregate root called User, this class is gonna have two inheritances :

   public class User : Entity, IAggregate
   {
       //Entity and model Codes
   }

Now for implementing the identity user, the User class should inherit from IdentityUser<int> but it is not possible to inherit multiple classes. I was thinking of a way which I could make a generic abstract class that implemented the abstract class Entity base class for the DDD and the generic type T that can be the Identity classes required by different entities, but it is not working as I expected and its not possible to do so in that way. So any one knows a way which could make it possible to inherit the identity class and DDD aggregation classes?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source