Skip to content

Commit 40a32c6

Browse files
authored
Merge pull request #11 from ekastimo/master
Skip properties whose propertyInfo value is null
2 parents c8cdd0c + 464645f commit 40a32c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/EntityFrameworkCore.DataEncryption/ModelBuilderExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.EntityFrameworkCore.DataEncryption.Internal;
1+
using System;
2+
using Microsoft.EntityFrameworkCore.DataEncryption.Internal;
23
using Microsoft.EntityFrameworkCore.Metadata;
34
using System.ComponentModel.DataAnnotations;
45
using System.Linq;
@@ -29,7 +30,6 @@ public static void UseEncryption(this ModelBuilder modelBuilder, IEncryptionProv
2930
if (property.ClrType == typeof(string) && !IsDiscriminator(property))
3031
{
3132
object[] attributes = property.PropertyInfo.GetCustomAttributes(typeof(EncryptedAttribute), false);
32-
3333
if (attributes.Any())
3434
property.SetValueConverter(encryptionConverter);
3535
}
@@ -39,7 +39,7 @@ public static void UseEncryption(this ModelBuilder modelBuilder, IEncryptionProv
3939

4040
private static bool IsDiscriminator(IMutableProperty property)
4141
{
42-
return property.Name == "Discriminator" && property.PropertyInfo == null;
42+
return property.Name == "Discriminator" || property.PropertyInfo == null;
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)