I am following Onion Architecture. And in that I am using ASP.NET Identity Framework.
Here is my Project Structure:
1-Core
- Domain Classes //It contains my T4 template classes
-- AppUser //It is Identity User.
- Repository Interfaces
- Service Interfaces
2-Infrastructure
- Data //It contains my edmx file, I am using Db First approach.
- Dependency Injection
- Repository Interfaces Implementation
- Service Interfaces Implementation
3-WebApi
- Web Api Project
4-WebClient
- My AngularJs App
5-Test
- Test Project
I have copied the scripts of the ASP.NET Identity tables and executed on my SQL Server. Which created Identity Tables for me.
In my Infrastructure.Data
project, I created an Edmx File
and inserted Identity tables in it. Then I moved my T4 template
to Core.Domain
, here I created Partial Class
for my AppUser
and other Identity tables.
// This make my Core.Domain project dependent on `Microsoft.AspNet.Identity`
// Which is a violation.
public partial class AppUser : IdentityUser
{
//My Custom Properties
}
Now I have confusion about my AppUser
Class which is in Core. According to the Onion Architecture standards, This whole layer should not a be dependent on any external library. But here I am using 'Microsoft.AspNet.Identity' in order to make my user as Identity User. Is there any solution for that?