Skip to content

Commit e904e5e

Browse files
committed
optimize EnablePropertyChangedTrack
1 parent da79a3d commit e904e5e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

build/version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<VersionMajor>4</VersionMajor>
44
<VersionMinor>0</VersionMinor>
5-
<VersionPatch>83</VersionPatch>
5+
<VersionPatch>84</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
77
</PropertyGroup>
88
</Project>

src/SmartSql/Deserializer/EntityDeserializer.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717

1818
namespace SmartSql.Deserializer
1919
{
20-
public class EntityDeserializer : IDataReaderDeserializer,ISetupSmartSql
20+
public class EntityDeserializer : IDataReaderDeserializer, ISetupSmartSql
2121
{
2222
private ILogger<EntityDeserializer> _logger;
23+
2324
public bool CanDeserialize(ExecutionContext executionContext, Type resultType, bool isMultiple = false)
2425
{
2526
return true;
@@ -97,7 +98,8 @@ private Delegate CreateDeserialize<TResult>(ExecutionContext executionContext)
9798
{
9899
if (resultType.GetProperties().Any(p => !p.SetMethod.IsVirtual))
99100
{
100-
_logger.LogWarning($"Type:{resultType.FullName} contain Non-Virtual Method,can not be enhanced by EntityProxy!");
101+
_logger.LogWarning(
102+
$"Type:{resultType.FullName} contain Non-Virtual Method,can not be enhanced by EntityProxy!");
101103
}
102104
else
103105
{
@@ -178,12 +180,13 @@ private Delegate CreateDeserialize<TResult>(ExecutionContext executionContext)
178180
LoadPropertyValue(ilGen, executionContext, colIndex, propertyType, filedType, resultProperty);
179181
ilGen.Call(property.SetMethod);
180182
}
181-
182-
if (resultType.IsAssignableFrom(typeof(IEntityPropertyChangedTrackProxy)))
183+
184+
if (typeof(IEntityPropertyChangedTrackProxy).IsAssignableFrom(resultType))
183185
{
184186
ilGen.LoadLocalVar(0);
185187
ilGen.LoadInt32(1);
186-
var setEnableTrackMethod = resultType.GetMethod(nameof(IEntityPropertyChangedTrackProxy.SetEnablePropertyChangedTrack));
188+
var setEnableTrackMethod =
189+
resultType.GetMethod(nameof(IEntityPropertyChangedTrackProxy.SetEnablePropertyChangedTrack));
187190
ilGen.Call(setEnableTrackMethod);
188191
}
189192

0 commit comments

Comments
 (0)