0

I'm building an api using asp.net web api for an application that needs to track all the activities performed by users. So in every table I need to have createdUser and updatedUser field with their dates. But I faced some challenges on how to go about.

Here are my concerns:

  1. How can I have that in the User table itself? Which type of relationship do I need for that?

  2. I have a privilege table than can be created by required users. What type of relationship can I have between the Privilege and the User table?

I'm new to Entity Framework so I need some guides. Please can anyone be very kind to provide some help. Thank you

Inno v8.2
  • 31
  • 3

1 Answers1

0
  1. I don't think u wil need to have that logic in the user table itself. U can add extra colomn's to each table with CreUser,CreDate, LModUser, LModDate. Or U can create an extra table like Entity_ID, Record_ID, User_ID, ModDate, IsCreated. (or with other logic)

  2. search for many to many relations on google. or:

How to create a many-to-many mapping in Entity Framework?

this is a nice tutorial for all kind of relationships in EF for core http://www.learnentityframeworkcore.com/configuration/one-to-many-relationship-configuration