EntitEntry.CurrentValue finishes setting the property value in EdmProperty , invoking the compiled expression tree constructed once (when constructing the entity model, and then using reflection) and is cached as Action :
Setting a property with this method is about 8 times slower than setting it directly, but still much faster than reflection, even when PropertyInfo cached. It is shown here . Summarizing:
Writing a Property ('Set') Method Mean =========================================== SetViaProperty 1.4043 ns SetViaDelegate 2.8215 ns SetViaILEmit 2.8226 ns SetViaCompiledExpressionTrees 10.7329 ns <= SetViaFastMember 36.6210 ns SetViaReflectionWithCaching 214.4321 ns SetViaReflection 287.1039 ns SetViaDelegateDynamicInvoke 922.4618 ns
So, as expected, EF uses the fastest method to set the value of a property in the object, which the installer must determine at run time. Faster methods require knowledge of compilation time for entity types or a third-party library.
source share