AltairCA.EntityFrameworkCore.PomeloMysql.Extensions 3.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package AltairCA.EntityFrameworkCore.PomeloMysql.Extensions --version 3.1.1                
NuGet\Install-Package AltairCA.EntityFrameworkCore.PomeloMysql.Extensions -Version 3.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AltairCA.EntityFrameworkCore.PomeloMysql.Extensions" Version="3.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AltairCA.EntityFrameworkCore.PomeloMysql.Extensions --version 3.1.1                
#r "nuget: AltairCA.EntityFrameworkCore.PomeloMysql.Extensions, 3.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AltairCA.EntityFrameworkCore.PomeloMysql.Extensions as a Cake Addin
#addin nuget:?package=AltairCA.EntityFrameworkCore.PomeloMysql.Extensions&version=3.1.1

// Install AltairCA.EntityFrameworkCore.PomeloMysql.Extensions as a Cake Tool
#tool nuget:?package=AltairCA.EntityFrameworkCore.PomeloMysql.Extensions&version=3.1.1                

AltairCA.EntityFrameworkCore.PomeloMysql.Extensions

Build Status

AltairCA.EntityFrameworkCore.PomeloMysql.Extensions is a Pomelo Mysql Extension that supports native MySQL AES encryption. Meaning this will support search query on encrypted columns. Well, this is good if you have GDPR compliance requirement.

Note

If you use this make sure your application to the MySQL service is use a encrypted connection because this will transmit the RAW PASSWORD over the network. You can enforce it in the connection string. example -

{
  "DefaultConnection": "server=127.0.0.1;database=youdb;user=root;password=;persistsecurityinfo=True;port=3306;SslMode=Required;CharSet=utf8mb4;"
}

take a look at SslMode=Required

AltairCA.EntityFrameworkCore.PomeloMysql.Extensions targets netstandard2.0. The package has following dependencies

<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />

When you choose the version choose with the .Net Core Version for example if .Net Core version is 3.1 then choose AltairCA.EntityFrameworkCore.PomeloMysql.Extensions version 3.1.x

setup

NuGet install:

Install-Package AltairCA.EntityFrameworkCore.PomeloMysql.Extensions

DbContext

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            optionsBuilder.UseEncryptionFunctions("HelloWorld1");
        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
            builder.UseEncryptAttribute("HelloWorld1");
        }

Replace HelloWorld with your password

Example of use

MysqlEncrypt Annotation Use
    public class TestModel
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        [MysqlEncrypt] #Use MysqlEncrypt attribute to denote the property must be encrypt in database
        public string Name { get; set; }
    }
How to use it in search query
var searchTest = _dbContext.TModels.Where(x => x.Name.MySqlDecrypt().Contains("test")).ToList();

Above Linq will convert to a Native MySql Query that will decrypt the column before it do a search.

You can find a example that I have used in the WebApplication Project HomeController.cs

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.0 1,777 4/14/2022
3.1.2 2,086 4/28/2020
3.1.1 475 4/26/2020