This is my first kind of task and i am using this tutorial. Link
The differences are that this tutorial is made in a single layer so it is easy accessing the Identity properties.
My project has
- Data Layer, where DB context is located (and all models dbsets)
- Entities(Models) that has reference to Data, Service and Presentation Layers
- Services that have reference to presentation layer
- Presentation Layer
The problem is that i put Audit model in Entities Layer, but in the tutorial it has foreign key to AspNetUsers table and code-first migration did not pass.
he ForeignKeyAttribute on property 'AuditUserId' on type 'Namespace.Entities.AuditActions.Audit' is not valid. The navigation property 'AuditUser' was not found on the dependent type 'Namespace.Entities.AuditActions.Audit'. The Name value should be a valid navigation property name
Second problem is that i cant access the User info from Data Layer where i have put the save overrides.
var currentUser = OwinContextHelper.CurrentApplicationUser;
I cant Access the OwinHelpper Class which is placed in presentation layer from the Data Layer where the overrides are placed.
How do i implement this tutorial in my application?
Any idea will be welcomed.
Be easy on me am a junior dev :)