Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Guys,

Please help me to know the correct approach to follow, in the development of a healthcare project using ASP.NET MVC.

In this project I am using EF6 with Code first approach and using WEB API. Few queries are not allowing me to proceed please help:
I am wondering how should i proceed to maintain the data history(audit) for the entire database? Please suggest

Secondly the client doesn't want to delete any records but set them to inactive state.

What I have tried:

To achieve these using EF6 I have created the stored procedure for all the models and modified the delete stored procedure to set the record to inactive state rather then deleting it. And I have triggers running on the tables to keep the history.

But now if i make any changes to the model all the stored procedures keep updating. I understand that the stored procedure which get modified are the Create and Update only. But i was wondering if in any case do the delete stored procedure also changes?

And i am not very much sure if I am proceeding in the right direction.

Please suggest how to mange the data history? should i proceed with EF or create my own stored procedures.
Posted
Comments
F-ES Sitecore 19-Oct-16 6:47am    
If you're using stored procs to CRUD your data then I wouldn't bother with EF, just use ado.net.
Sanjay_MVC 20-Oct-16 6:09am    
These stored procs are generated by EF6
[no name] 21-Oct-16 18:05pm    
Why are you using triggers? What do these triggers do? In my opinion it is quite simple. Add an IsDeleted flag to each table and update your EF model. Why use stored procedures and triggers? Or is it more complicated?
Sanjay_MVC 24-Oct-16 9:00am    
I have triggers to log the history. History is maintained for each table and we pass the userID to the Create,Update and Delete stored procedures.
And each table has a trigger which reads the UserID and the changes to the table and maintains the history for the records modified.

And for deleted we are maintaining a flag in my case it is IsActive.

All i want to know is how do I manage to save history for the records modified. Is there a proper way in EF or should I use triggers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900