Closed davidkeaveny closed 1 year ago
done :)
use the following extension
public class TestingConfiguration:IEntityTypeConfiguration<Testings>
{
public void Configure(EntityTypeBuilder<Testings> builder)
{
builder.Property(x => x.encrypted)
.UseEncryption("NBJ42RKQ2vQoYFZOj1C83921vHExVhVp1PlOAK6gjbMZI", EncKeyLength.L128);
}
}
Wow, thanks for the fast turn-around on this suggestion! One small question - in your example above, you have hard-coded the encryption key; do you have any suggestions for how to make that configurable?
you can inject that using Configurations or using any other provider to the DbContext and then pass that to the configuration
Would it be possible to add support for encrypting columns via extension methods on the
PropertyBuilder<T>
so that I can add encryption support to my model via theIEntityTypeConfiguration<T>
interface rather than having to decorate my model with additional attributes?e.g.