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

TypeAccessor doesn't allow to manipulate internal/private properties #84

Open
maxijuice opened this issue Apr 21, 2020 · 1 comment
Open

Comments

@maxijuice
Copy link

Hello,

I'm using EFCore.BulkExtensions. It's dependent on your library when it's needed to merge objects passed with ones returned from DbContext. The problem is that entity I use in DbSet, has internal fields. Unfortunately, TypeAccessor can't resolve them even though it's created with allowNonPublicAccessors = true.

I've checked this on a simple scenario and here are the results

static void Main(string[] args)
 {
     var accessor = TypeAccessor.Create(typeof(TestClass), true);  
     Console.WriteLine(accessor.GetMembers().Count);  // output is 0
}

class TestClass
 {
      internal string InternalField { get; set; }
      private int PrivateField { get; set; }
}

Is it a desired behavior?

@robertjak
Copy link

robertjak commented Apr 29, 2020

I've just created a pull request with a fix for the issue above, so the internal and private properties are read as well.

Private fields are still ignored (?), I suppose they are almost never needed, but this could be easily fixed/changed as well.

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

No branches or pull requests

2 participants