This project is read-only.

Skip properties of nested objects

Jul 19, 2011 at 1:20 PM


While using the Unbinder I came across the need to skip properties of nested objects.

For example, if I have the following view model:

public class NestedViewModel 
    public int Value { get; set; }
    public int PropertyToSkip { get; set; }

public class ViewModel
    public NestedViewModel Nested { get; set; }

I would like to instruct the Unbinder that when unbinding an object of type ViewModel it should skip the property PropertyToSkip, by calling the extension method like so

ViewModel viewModel = new ViewModel()
     Nested = new NestedViewModel() 
            Value = 1,
            PropertyToSkip = 2

viewModel.ToHttpDictionary(x => x.Nested.PropertyToSkip);

The current implementation reads only the name of the properties and therefore does not support this scenario. I downloaded the source code and made the necessary changes locally. I'd like to contribute these changes but I'm not sure how you would prefer that. Would you like me to create a fork or send you the changes?

Thanx for implementing this btw, it's quite useful.


Mar 14, 2013 at 11:21 AM
Hello Kostas. This is exactly what I am looking for. Have you ever found the time to contribute your changes?
Mar 15, 2013 at 5:28 PM
Hi, I never got any response to the above comment so eventually I forgot. I'll try to dig up that code (from almost two years ago!) and post it here...