samedi 10 mars 2018

Does the Entity Framework DbEntityEntry.Property method use reflection?

This question is about this code:

entityEntry.Property("WhateverProperty").CurrentValue = 1;

I answered this question yesterday and if you notice in the comments to the question (not the answer), one of the members @gertarnold said this:

entityEntry.Property("InsertedBy") doesn't use reflection, it reads the EF metadata.

Sure it uses the EF metadata to figure out if the entity has that property but I am pretty sure somewhere down the line they would have to use reflection to set the property.

I tried looking at the source code here, here and here (line 484) and then chickened out.

So the questions are:

  1. Does it use reflection?
  2. If not, how is the property set then?




Aucun commentaire:

Enregistrer un commentaire