forked from DapperLib/Dapper.Contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor property info handling, allow keys different from Id property
- Only treat a property named 'Id' as a key if there is no Key or ExplicitKey property. (fixes DapperLib#140) The new behavior allows manually specifying a key (or explicit key) that is different from the 'Id' property. Any usage that would previously have succeeded (not thrown an exception) is unaffected. - Introduce PropertyInfoWrapper to hold all the relevant information about a type's properties. - Move logic about selecting a key into the PropertyInfoWrapper so it can be cached as well. - Use a single ConcurrentDictionary of PropertyInfoWrappers instead of one for each type of property. Thread-safety is preserved because all mutation happens inside a thread-safe Lazy<T>. - Add `PropertyNamedId` to distinguish this property from those explicitly annotated with a `KeyAttribute`.
1 parent
cf24f6b
commit a2f53a3
Showing
1 changed file
with
259 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters