├── .gitignore ├── EntityFramework.Core.EncryptDBColumn ├── Attribute │ └── EncryptColumnAttribute.cs ├── Converter │ └── EncryptionConverter.cs ├── EntityFrameworkCore.EncryptColumn.csproj ├── Extension │ └── ModelBuilderExtension.cs ├── Interfaces │ └── IEncryptionProvider.cs ├── Util │ └── GenerateEncryptionProvider.cs └── icon.png ├── EntityFrameworkCore.EncryptColumn.sln ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # globs 2 | Makefile.in 3 | *.userprefs 4 | *.usertasks 5 | config.make 6 | config.status 7 | aclocal.m4 8 | install-sh 9 | autom4te.cache/ 10 | *.tar.gz 11 | tarballs/ 12 | test-results/ 13 | 14 | # Mac bundle stuff 15 | *.dmg 16 | *.app 17 | 18 | # content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore 19 | # General 20 | .DS_Store 21 | .AppleDouble 22 | .LSOverride 23 | 24 | # Icon must end with two \r 25 | Icon 26 | 27 | 28 | # Thumbnails 29 | ._* 30 | 31 | # Files that might appear in the root of a volume 32 | .DocumentRevisions-V100 33 | .fseventsd 34 | .Spotlight-V100 35 | .TemporaryItems 36 | .Trashes 37 | .VolumeIcon.icns 38 | .com.apple.timemachine.donotpresent 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | # content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore 48 | # Windows thumbnail cache files 49 | Thumbs.db 50 | ehthumbs.db 51 | ehthumbs_vista.db 52 | 53 | # Dump file 54 | *.stackdump 55 | 56 | # Folder config file 57 | [Dd]esktop.ini 58 | 59 | # Recycle Bin used on file shares 60 | $RECYCLE.BIN/ 61 | 62 | # Windows Installer files 63 | *.cab 64 | *.msi 65 | *.msix 66 | *.msm 67 | *.msp 68 | 69 | # Windows shortcuts 70 | *.lnk 71 | 72 | # content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 73 | ## Ignore Visual Studio temporary files, build results, and 74 | ## files generated by popular Visual Studio add-ons. 75 | ## 76 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 77 | 78 | # User-specific files 79 | *.suo 80 | *.user 81 | *.userosscache 82 | *.sln.docstates 83 | 84 | # User-specific files (MonoDevelop/Xamarin Studio) 85 | *.userprefs 86 | 87 | # Build results 88 | [Dd]ebug/ 89 | [Dd]ebugPublic/ 90 | [Rr]elease/ 91 | [Rr]eleases/ 92 | x64/ 93 | x86/ 94 | bld/ 95 | [Bb]in/ 96 | [Oo]bj/ 97 | [Ll]og/ 98 | 99 | # Visual Studio 2015/2017 cache/options directory 100 | .vs/ 101 | # Uncomment if you have tasks that create the project's static files in wwwroot 102 | #wwwroot/ 103 | 104 | # Visual Studio 2017 auto generated files 105 | Generated\ Files/ 106 | 107 | # MSTest test Results 108 | [Tt]est[Rr]esult*/ 109 | [Bb]uild[Ll]og.* 110 | 111 | # NUNIT 112 | *.VisualState.xml 113 | TestResult.xml 114 | 115 | # Build Results of an ATL Project 116 | [Dd]ebugPS/ 117 | [Rr]eleasePS/ 118 | dlldata.c 119 | 120 | # Benchmark Results 121 | BenchmarkDotNet.Artifacts/ 122 | 123 | # .NET Core 124 | project.lock.json 125 | project.fragment.lock.json 126 | artifacts/ 127 | 128 | # StyleCop 129 | StyleCopReport.xml 130 | 131 | # Files built by Visual Studio 132 | *_i.c 133 | *_p.c 134 | *_h.h 135 | *.ilk 136 | *.meta 137 | *.obj 138 | *.iobj 139 | *.pch 140 | *.pdb 141 | *.ipdb 142 | *.pgc 143 | *.pgd 144 | *.rsp 145 | *.sbr 146 | *.tlb 147 | *.tli 148 | *.tlh 149 | *.tmp 150 | *.tmp_proj 151 | *_wpftmp.csproj 152 | *.log 153 | *.vspscc 154 | *.vssscc 155 | .builds 156 | *.pidb 157 | *.svclog 158 | *.scc 159 | 160 | # Chutzpah Test files 161 | _Chutzpah* 162 | 163 | # Visual C++ cache files 164 | ipch/ 165 | *.aps 166 | *.ncb 167 | *.opendb 168 | *.opensdf 169 | *.sdf 170 | *.cachefile 171 | *.VC.db 172 | *.VC.VC.opendb 173 | 174 | # Visual Studio profiler 175 | *.psess 176 | *.vsp 177 | *.vspx 178 | *.sap 179 | 180 | # Visual Studio Trace Files 181 | *.e2e 182 | 183 | # TFS 2012 Local Workspace 184 | $tf/ 185 | 186 | # Guidance Automation Toolkit 187 | *.gpState 188 | 189 | # ReSharper is a .NET coding add-in 190 | _ReSharper*/ 191 | *.[Rr]e[Ss]harper 192 | *.DotSettings.user 193 | 194 | # JustCode is a .NET coding add-in 195 | .JustCode 196 | 197 | # TeamCity is a build add-in 198 | _TeamCity* 199 | 200 | # DotCover is a Code Coverage Tool 201 | *.dotCover 202 | 203 | # AxoCover is a Code Coverage Tool 204 | .axoCover/* 205 | !.axoCover/settings.json 206 | 207 | # Visual Studio code coverage results 208 | *.coverage 209 | *.coveragexml 210 | 211 | # NCrunch 212 | _NCrunch_* 213 | .*crunch*.local.xml 214 | nCrunchTemp_* 215 | 216 | # MightyMoose 217 | *.mm.* 218 | AutoTest.Net/ 219 | 220 | # Web workbench (sass) 221 | .sass-cache/ 222 | 223 | # Installshield output folder 224 | [Ee]xpress/ 225 | 226 | # DocProject is a documentation generator add-in 227 | DocProject/buildhelp/ 228 | DocProject/Help/*.HxT 229 | DocProject/Help/*.HxC 230 | DocProject/Help/*.hhc 231 | DocProject/Help/*.hhk 232 | DocProject/Help/*.hhp 233 | DocProject/Help/Html2 234 | DocProject/Help/html 235 | 236 | # Click-Once directory 237 | publish/ 238 | 239 | # Publish Web Output 240 | *.[Pp]ublish.xml 241 | *.azurePubxml 242 | # Note: Comment the next line if you want to checkin your web deploy settings, 243 | # but database connection strings (with potential passwords) will be unencrypted 244 | *.pubxml 245 | *.publishproj 246 | 247 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 248 | # checkin your Azure Web App publish settings, but sensitive information contained 249 | # in these scripts will be unencrypted 250 | PublishScripts/ 251 | 252 | # NuGet Packages 253 | *.nupkg 254 | # The packages folder can be ignored because of Package Restore 255 | **/[Pp]ackages/* 256 | # except build/, which is used as an MSBuild target. 257 | !**/[Pp]ackages/build/ 258 | # Uncomment if necessary however generally it will be regenerated when needed 259 | #!**/[Pp]ackages/repositories.config 260 | # NuGet v3's project.json files produces more ignorable files 261 | *.nuget.props 262 | *.nuget.targets 263 | 264 | # Microsoft Azure Build Output 265 | csx/ 266 | *.build.csdef 267 | 268 | # Microsoft Azure Emulator 269 | ecf/ 270 | rcf/ 271 | 272 | # Windows Store app package directories and files 273 | AppPackages/ 274 | BundleArtifacts/ 275 | Package.StoreAssociation.xml 276 | _pkginfo.txt 277 | *.appx 278 | 279 | # Visual Studio cache files 280 | # files ending in .cache can be ignored 281 | *.[Cc]ache 282 | # but keep track of directories ending in .cache 283 | !*.[Cc]ache/ 284 | 285 | # Others 286 | ClientBin/ 287 | ~$* 288 | *~ 289 | *.dbmdl 290 | *.dbproj.schemaview 291 | *.jfm 292 | *.pfx 293 | *.publishsettings 294 | orleans.codegen.cs 295 | 296 | # Including strong name files can present a security risk 297 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 298 | #*.snk 299 | 300 | # Since there are multiple workflows, uncomment next line to ignore bower_components 301 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 302 | #bower_components/ 303 | 304 | # RIA/Silverlight projects 305 | Generated_Code/ 306 | 307 | # Backup & report files from converting an old project file 308 | # to a newer Visual Studio version. Backup files are not needed, 309 | # because we have git ;-) 310 | _UpgradeReport_Files/ 311 | Backup*/ 312 | UpgradeLog*.XML 313 | UpgradeLog*.htm 314 | ServiceFabricBackup/ 315 | *.rptproj.bak 316 | 317 | # SQL Server files 318 | *.mdf 319 | *.ldf 320 | *.ndf 321 | 322 | # Business Intelligence projects 323 | *.rdl.data 324 | *.bim.layout 325 | *.bim_*.settings 326 | *.rptproj.rsuser 327 | 328 | # Microsoft Fakes 329 | FakesAssemblies/ 330 | 331 | # GhostDoc plugin setting file 332 | *.GhostDoc.xml 333 | 334 | # Node.js Tools for Visual Studio 335 | .ntvs_analysis.dat 336 | node_modules/ 337 | 338 | # Visual Studio 6 build log 339 | *.plg 340 | 341 | # Visual Studio 6 workspace options file 342 | *.opt 343 | 344 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 345 | *.vbw 346 | 347 | # Visual Studio LightSwitch build output 348 | **/*.HTMLClient/GeneratedArtifacts 349 | **/*.DesktopClient/GeneratedArtifacts 350 | **/*.DesktopClient/ModelManifest.xml 351 | **/*.Server/GeneratedArtifacts 352 | **/*.Server/ModelManifest.xml 353 | _Pvt_Extensions 354 | 355 | # Paket dependency manager 356 | .paket/paket.exe 357 | paket-files/ 358 | 359 | # FAKE - F# Make 360 | .fake/ 361 | 362 | # JetBrains Rider 363 | .idea/ 364 | *.sln.iml 365 | 366 | # CodeRush personal settings 367 | .cr/personal 368 | 369 | # Python Tools for Visual Studio (PTVS) 370 | __pycache__/ 371 | *.pyc 372 | 373 | # Cake - Uncomment if you are using it 374 | # tools/** 375 | # !tools/packages.config 376 | 377 | # Tabs Studio 378 | *.tss 379 | 380 | # Telerik's JustMock configuration file 381 | *.jmconfig 382 | 383 | # BizTalk build output 384 | *.btp.cs 385 | *.btm.cs 386 | *.odx.cs 387 | *.xsd.cs 388 | 389 | # OpenCover UI analysis results 390 | OpenCover/ 391 | 392 | # Azure Stream Analytics local run output 393 | ASALocalRun/ 394 | 395 | # MSBuild Binary and Structured Log 396 | *.binlog 397 | 398 | # NVidia Nsight GPU debugger configuration file 399 | *.nvuser 400 | 401 | # MFractors (Xamarin productivity tool) working folder 402 | .mfractor/ 403 | 404 | # Local History for Visual Studio 405 | .localhistory/ -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/Attribute/EncryptColumnAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EntityFrameworkCore.EncryptColumn.Attribute 4 | { 5 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] 6 | public sealed class EncryptColumnAttribute : System.Attribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/Converter/EncryptionConverter.cs: -------------------------------------------------------------------------------- 1 | using EntityFrameworkCore.EncryptColumn.Interfaces; 2 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 3 | 4 | namespace EntityFrameworkCore.EncryptColumn.Converter 5 | { 6 | internal sealed class EncryptionConverter : ValueConverter 7 | { 8 | public EncryptionConverter(IEncryptionProvider encryptionProvider, ConverterMappingHints mappingHints = null) : base (x => encryptionProvider.Encrypt(x), x => encryptionProvider.Decrypt(x), mappingHints) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/EntityFrameworkCore.EncryptColumn.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0 5 | true 6 | 9.0 7 | Emre Kizildas 8 | https://github.com/emrekizildas/EntityFrameworkCore.EncryptColumn/raw/main/EntityFramework.Core.EncryptDBColumn/icon.png 9 | en-US 10 | Emre Kizildas 11 | https://github.com/emrekizildas/EntityFrameworkCore.EncryptColumn 12 | Encrypt & Decrypt your databases columns using EntityFramework Core. 13 | entityframeworkcore, encryption, encrypt sql, encrypt column, entityframework 14 | EntityFrameworkCore.EncryptColumn 15 | Use EncryptColumn attribute and your database columns encrtypted. Automatic encrypt and decrypt your columns. 16 | EntityFrameworkCore.EncryptColumn 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | runtime; build; native; contentfiles; analyzers; buildtransitive 30 | all 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/Extension/ModelBuilderExtension.cs: -------------------------------------------------------------------------------- 1 | using EntityFrameworkCore.EncryptColumn.Interfaces; 2 | using EntityFrameworkCore.EncryptColumn.Converter; 3 | using EntityFrameworkCore.EncryptColumn.Attribute; 4 | using System.Linq; 5 | using System.Reflection; 6 | using Microsoft.EntityFrameworkCore; 7 | using Microsoft.EntityFrameworkCore.Metadata; 8 | using System; 9 | 10 | namespace EntityFrameworkCore.EncryptColumn.Extension 11 | { 12 | public static class ModelBuilderExtension 13 | { 14 | public static void UseEncryption(this ModelBuilder modelBuilder, IEncryptionProvider encryptionProvider) 15 | { 16 | if (modelBuilder is null) 17 | throw new ArgumentNullException(nameof(modelBuilder), "There is not ModelBuilder object."); 18 | if (encryptionProvider is null) 19 | throw new ArgumentNullException(nameof(encryptionProvider), "You should create encryption provider."); 20 | 21 | var encryptionConverter = new EncryptionConverter(encryptionProvider); 22 | foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes()) 23 | { 24 | foreach (IMutableProperty property in entityType.GetProperties()) 25 | { 26 | if(property.ClrType == typeof(string) && !IsDiscriminator(property)) 27 | { 28 | object[] attributes = property.PropertyInfo.GetCustomAttributes(typeof(EncryptColumnAttribute), false); 29 | if(attributes.Any()) 30 | property.SetValueConverter(encryptionConverter); 31 | } 32 | } 33 | } 34 | 35 | } 36 | 37 | private static bool IsDiscriminator(IMutableProperty property) => property.Name == "Discriminator" || property.PropertyInfo == null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/Interfaces/IEncryptionProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace EntityFrameworkCore.EncryptColumn.Interfaces 3 | { 4 | public interface IEncryptionProvider 5 | { 6 | string Encrypt(string dataToEncrypt); 7 | string Decrypt(string dataToDecrypt); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/Util/GenerateEncryptionProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | using EntityFrameworkCore.EncryptColumn.Interfaces; 6 | 7 | namespace EntityFrameworkCore.EncryptColumn.Util 8 | { 9 | public class GenerateEncryptionProvider : IEncryptionProvider 10 | { 11 | private readonly string key; 12 | public GenerateEncryptionProvider(string key) 13 | { 14 | this.key = key; 15 | } 16 | 17 | public string Encrypt(string dataToEncrypt) 18 | { 19 | if (string.IsNullOrEmpty(key)) 20 | throw new ArgumentNullException("EncryptionKey", "Please initialize your encryption key."); 21 | 22 | if (string.IsNullOrEmpty(dataToEncrypt)) 23 | return string.Empty; 24 | 25 | byte[] iv = new byte[16]; 26 | byte[] array; 27 | 28 | using (Aes aes = Aes.Create()) 29 | { 30 | aes.Key = Encoding.UTF8.GetBytes(key); 31 | aes.IV = iv; 32 | 33 | ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV); 34 | using (MemoryStream memoryStream = new MemoryStream()) 35 | { 36 | using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, encryptor, CryptoStreamMode.Write)) 37 | { 38 | using (StreamWriter streamWriter = new StreamWriter((Stream)cryptoStream)) 39 | { 40 | streamWriter.Write(dataToEncrypt); 41 | } 42 | array = memoryStream.ToArray(); 43 | } 44 | } 45 | } 46 | string result = Convert.ToBase64String(array); 47 | return result; 48 | } 49 | 50 | public string Decrypt(string dataToDecrypt) 51 | { 52 | if (string.IsNullOrEmpty(key)) 53 | throw new ArgumentNullException("EncryptionKey", "Please initialize your encryption key."); 54 | 55 | if (string.IsNullOrEmpty(dataToDecrypt)) 56 | return string.Empty; 57 | 58 | byte[] iv = new byte[16]; 59 | 60 | using (Aes aes = Aes.Create()) 61 | { 62 | aes.Key = Encoding.UTF8.GetBytes(key); 63 | aes.IV = iv; 64 | ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV); 65 | 66 | var buffer = Convert.FromBase64String(dataToDecrypt); 67 | using (MemoryStream memoryStream = new MemoryStream(buffer)) 68 | { 69 | using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, decryptor, CryptoStreamMode.Read)) 70 | { 71 | using (StreamReader streamReader = new StreamReader((Stream)cryptoStream)) 72 | { 73 | return streamReader.ReadToEnd(); 74 | } 75 | } 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /EntityFramework.Core.EncryptDBColumn/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emrekizildas/EntityFrameworkCore.EncryptColumn/a067237c2a228624ce5513b1b09af50207e75054/EntityFramework.Core.EncryptDBColumn/icon.png -------------------------------------------------------------------------------- /EntityFrameworkCore.EncryptColumn.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.809.7 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.EncryptColumn", "EntityFramework.Core.EncryptDBColumn\EntityFrameworkCore.EncryptColumn.csproj", "{0B0D7458-8F77-4F22-B6F6-38AA76637D47}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0B0D7458-8F77-4F22-B6F6-38AA76637D47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {0B0D7458-8F77-4F22-B6F6-38AA76637D47}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {0B0D7458-8F77-4F22-B6F6-38AA76637D47}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {0B0D7458-8F77-4F22-B6F6-38AA76637D47}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {8376DDC4-AA80-42FE-9992-807BAE1446BE} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Emre Kızıldaş 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EntityFrameworkCore.EncryptColumn 2 | Hello, you can store your data in encrypted form in your database with this package. 3 | 4 | ## How to use? 5 | Install "[EntityFrameworkCore.EncryptColumn](https://www.nuget.org/packages/EntityFrameworkCore.EncryptColumn)" package to your project. 6 | 7 | Specify your encryption key in the constructor method of your DbContext class and create a instance from the encryption provider. Yout encryption key must be 128 bit! 8 | 9 | ```csharp 10 | private readonly IEncryptionProvider _provider; 11 | public ExampleDbContext() 12 | { 13 | this._provider = new GenerateEncryptionProvider("example_encrypt_key"); 14 | } 15 | ``` 16 | Then specify that you will use an encryption provider in the "OnModelCreating" method. 17 | 18 | ```csharp 19 | modelBuilder.UseEncryption(this._provider); 20 | ``` 21 | 22 | That's it! Now you can encrypt the parameters in the class you want by adding the "EncryptColumn" attribute. 23 | 24 | ```csharp 25 | public class User 26 | { 27 | public Guid ID { get; set; } 28 | public string Firstname { get; set; } 29 | public string Lastname { get; set; } 30 | [EncryptColumn] 31 | public string EmailAddress { get; set; } 32 | [EncryptColumn] 33 | public string IdentityNumber { get; set; } 34 | } 35 | ``` 36 | 37 | You can take a look at the [example project here](https://github.com/emrekizildas/EntityFrameworkCore.EncryptColumn.Example). 38 | 39 | ## Contact 40 | You can send an e-mail to kizildas@icloud.com for your problems related to the project. You can also create an issue in repository. 41 | --------------------------------------------------------------------------------