Support for EF database-first methodology?

Nov 22, 2012 at 7:03 PM


We're in a situation where we'd like to store sensitive information in Azure SQL. We're rolling out our own. In fact I even posted on asking for a good design pattern to implement application level crypto against Azure SQL.

Then I ran into your library but noticed you support only code-first. Considering the rest of EF (after class generation) is the same beneath whether it be code-first, model-first or database first approaches- is there a way to use your library with EF database-first?

It would be awesome if you could have  small "HOWTO" or a little article in the docs section on setting / using your library in such a scenario


PS: We used to be code-first but had to switch to database first as the project grew. 

Dec 11, 2012 at 9:05 PM

Sid - just thinking through this - with database-first, there are some things we'd have to work out:

  • Adding the SecurEntity metadata column to each table that you want to protect. Without this, we have nowhere to stick the row encryption key and integrity data. It's possible you could add this manually to your schema.
  • Registering the encryption/decryption callbacks. Perhaps at runtime, you can still do this in more or less the same way?

Even with your database-first approach, can you get EF to reverse generate the code classes, so to speak?