From e2c3c07732ded0b985ddff067f92e6b4f379f8cd Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Tue, 27 Sep 2011 10:05:32 +1000 Subject: [PATCH] patch by matt...@amigarulez.se, Some grids active/Telerik and other edge cases use reflection and other methods to cache members. Current implementation results in inconsistent between the wrapper object and the underlying dictionary because the DynamicObject members are returned and not the underlying dictionary. Simple fix basically add an override to FastExpando class and reflection acts consistently. --- Dapper/SqlMapper.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index 6acace9..8a44bf4 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -831,6 +831,11 @@ public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out obj return data.TryGetValue(binder.Name, out result); } + public override IEnumerable GetDynamicMemberNames() + { + return data.Keys; + } + #region IDictionary Members void IDictionary.Add(string key, object value) @@ -871,7 +876,11 @@ public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out obj } set { - throw new NotImplementedException(); + if (!data.ContainsKey(key)) + { + throw new NotImplementedException(); + } + data[key] = value; } } -- GitLab