-
Notifications
You must be signed in to change notification settings - Fork 0
How To Use
Furkan Güngör edited this page May 21, 2022
·
5 revisions
This repository has two libraries.
These libraries the following items;
EntityFrameworkCore.DataEncryption.Conversions
EntityFrameworkCore.DataEncryption.Core
This library contains base operations for Data Encryption issue.
This library provides data encryption.
Therefore, firstly install EntityFrameworkCore.DataEncryption.Conversions
package from Nuget
Install-Package EntityFrameworkCore.DataEncryption.Conversions
Then mark the columns to be encrypted in DbContext.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Author>(entity =>
{
entity
.Property(p => p.Id)
.UseIdentityColumn();
entity
.Property(p => p.Name)
.IsRequired()
.HasMaxLength(2048);
entity
.Property(p => p.Surname)
.IsRequired()
.HasMaxLength(2048);
entity
.Property(p => p.Phone)
.IsRequired()
.HasConversion(new EncryptValueConverter("89acMXSBpuEBDWHZ"));
});
base.OnModelCreating(modelBuilder);
}
Note
Encryption operation will uses private key. Therefore must be set value for constructor parameter.
Welcome to the EntityFrameworkCore.DataEncryption
wiki!
Topics: