Eastrall / EntityFrameworkCore.DataEncryption

A plugin for Microsoft.EntityFrameworkCore to add support of encrypted fields using built-in or custom encryption providers.
MIT License
326 stars 54 forks source link

Feature/fluent api #8

Closed tducheyne closed 2 years ago

tducheyne commented 4 years ago

This PR adds support for Fluent API.

The only thing I'm not 100% happy with is the early return in the PropertyBuilder extension method. It's there only to accommodate the test methodology of creating a DbContext without an encryption provider for validation purposes.

I feel that this methodology is incorrect and that validation should be done with a diffent DbContext, but that's an issue for another PR.

codecov-commenter commented 4 years ago

Codecov Report

Merging #8 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master        #8    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           10         5     -5     
  Lines          233        63   -170     
==========================================
- Hits           233        63   -170     
Impacted Files Coverage Δ
...rkCore.DataEncryption/PropertyBuilderExtensions.cs 100.00% <100.00%> (ø)
...meworkCore.DataEncryption/Providers/AesProvider.cs 100.00% <0.00%> (ø)
...eworkCore.DataEncryption/ModelBuilderExtensions.cs 100.00% <0.00%> (ø)
...ore.DataEncryption/Internal/EncryptionConverter.cs 100.00% <0.00%> (ø)
...workCore.DataEncryption.Test/Context/BookEntity.cs
...rkCore.DataEncryption.Test/Helpers/StringHelper.cs
...aEncryption.Test/Context/DatabaseContextFactory.cs

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 773c722...6ddbc2f. Read the comment docs.

Eastrall commented 3 years ago

Hi, sorry for the late reply about this PR. About the return, you could just throw an ArgumentNullException instead of returning.

if (encryptionProvider == null)
{
    throw new ArgumentNullException(nameof(encryptionProvider), "Cannot initialize encryption with a null provider.");
}

I am OK with this PR for now. I let you replace the return with a throw if you want. Otherwise I'll merge this PR in develop branch.

omri-legit commented 3 years ago

Hey guys,

Thanks for this, exactly what I was looking for. @Eastrall - Any estimation on when it's gonna be merged/released?

Thanks!

loic-montagne commented 2 years ago

Hello,

I would like to know when this PR will gonna be released please ?

Thanks !