A couple things off the top here, we're using .net core 2.0 and entity framework core, so we can't use the always encrypted columns in SQL server as it's not supported yet. I've discovered the Data Protection API for Asp.net core, and I've been trying to figure out a way to use it to encrypt a few of the fields.
I found this article on how to add encryption to selected fields (link), but it doesn't really deal with how to do the actual encryption. So, basically, I've been trying to figure out a way to inject the Data Protection service into my model classes so I can use the Protect and Unprotect methods.
I've tried configuring our DI container (autofac) to inject it as a property, but DI doesn't seem to have anything to do with instantiating the EF objects. I also tried to set it in the OnModelCreating event of the DbContext, but that doesn't seem to work either.
Maybe someone can tell me a better way of doing this, or is my approach all wrong? Thanks.