mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-30 19:45:57 +00:00
read is done using simple reflection strategy.
This commit is contained in:
parent
a46ef37f0b
commit
9db5b7963e
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ public class DelegateReflectionStrategy : IReflectionStrategy
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<string, PropertySetterDelegate> SetterCache = new Dictionary<string, PropertySetterDelegate>();
|
private static readonly Dictionary<string, PropertySetterDelegate> SetterCache = new Dictionary<string, PropertySetterDelegate>();
|
||||||
private static readonly Dictionary<string, PropertyGetterDelegate> GetterCache = new Dictionary<string, PropertyGetterDelegate>();
|
private static readonly Dictionary<string, PropertyGetterDelegate> GetterCache = new Dictionary<string, PropertyGetterDelegate>();
|
||||||
|
private static readonly IReflectionStrategy readStrat = new SimpleReflectionStrategy();
|
||||||
|
|
||||||
private static PropertySetterDelegate SetterFunction(Type entityType, string name)
|
private static PropertySetterDelegate SetterFunction(Type entityType, string name)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +49,7 @@ public void SetFieldValue<T>(T entity, string fieldName, object val)
|
||||||
|
|
||||||
public object GetFieldValue(object entity, string fieldName)
|
public object GetFieldValue(object entity, string fieldName)
|
||||||
{
|
{
|
||||||
return GetterFunction(entity.GetType(), fieldName);
|
return readStrat.GetFieldValue(entity, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object CreateInstance(Type type)
|
public object CreateInstance(Type type)
|
||||||
|
|
Loading…
Reference in a new issue