This link could be helpful for you:
https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/workflows/existing-database