Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowNonPublicAccessors does not work with ObjectAccessor #12

Open
GoogleCodeExporter opened this issue Oct 15, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

Here is your code
As you can see allowNonPublicAccessors is not used

    /// <summary>
    /// Wraps an individual object, allowing by-name access to that instance
    /// 
    /// </summary>
    public static ObjectAccessor Create(object target, bool allowNonPublicAccessors)
    {
      if (target == null)
        throw new ArgumentNullException("target");
      IDynamicMetaObjectProvider target1 = target as IDynamicMetaObjectProvider;
      if (target1 != null)
        return (ObjectAccessor) new ObjectAccessor.DynamicWrapper(target1);
      else
        return (ObjectAccessor) new ObjectAccessor.TypeAccessorWrapper(target, TypeAccessor.Create(target.GetType()));
    }

Original issue reported on code.google.com by [email protected] on 28 Nov 2014 at 3:20

@GoogleCodeExporter
Copy link
Author

For fixit. add second parameter at   TypeAccessor.Create.

diff --git a/FastMember/ObjectAccessor.cs b/FastMember/ObjectAccessor.cs
index 13b77cc..5f40b34 100644
--- a/FastMember/ObjectAccessor.cs
+++ b/FastMember/ObjectAccessor.cs
@@ -58,7 +58,7 @@ public static ObjectAccessor Create(object target, bool 
allowNonPublicAccessors)
             IDynamicMetaObjectProvider dlr = target as IDynamicMetaObjectProvider;
             if (dlr != null) return new DynamicWrapper(dlr); // use the DLR
 #endif
-            return new TypeAccessorWrapper(target, 
TypeAccessor.Create(target.GetType()));
+            return new TypeAccessorWrapper(target, 
TypeAccessor.Create(target.GetType(), allowNonPublicAccessors));
         }
         sealed class TypeAccessorWrapper : ObjectAccessor
         {

Original comment by [email protected] on 1 Apr 2015 at 10:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant