Skip to content

Commit da17361

Browse files
author
Filipe GOMES PEIXOTO
committed
Replace return with exception
1 parent ec6b954 commit da17361

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/EntityFrameworkCore.DataEncryption/ModelBuilderExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Microsoft.EntityFrameworkCore.DataEncryption.Internal;
33
using Microsoft.EntityFrameworkCore.Metadata;
4+
using System;
45
using System.ComponentModel.DataAnnotations;
56
using System.Linq;
67

@@ -20,7 +21,7 @@ public static void UseEncryption(this ModelBuilder modelBuilder, IEncryptionProv
2021
{
2122
if (encryptionProvider == null)
2223
{
23-
return;
24+
throw new ArgumentNullException(nameof(encryptionProvider), "Cannot initialize encryption with a null provider.");
2425
}
2526

2627
var encryptionConverter = new EncryptionConverter(encryptionProvider);

test/EntityFrameworkCore.DataEncryption.Test/Context/DatabaseContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public DatabaseContext(DbContextOptions options, IEncryptionProvider encryptionP
1818
_encryptionProvider = encryptionProvider;
1919
}
2020
protected override void OnModelCreating(ModelBuilder modelBuilder)
21-
=> modelBuilder.UseEncryption(_encryptionProvider);
21+
{
22+
modelBuilder.UseEncryption(_encryptionProvider);
23+
}
2224
}
2325
}

0 commit comments

Comments
 (0)