Reusing (un)flattening logic per property...

Jun 6, 2012 at 10:14 PM

Is there any way I can reuse some of ValueInjecter helper classes to get property name from flattened target as string path of unflattened source?

Example may be explain everything

To use example test classes

        public class Foo
            public string NameZype { get; set; }
            public int Age { get; set; }

        public class FlatFoo

            public string Foo2NameZype { get; set; }
            public string Foo1Age { get; set; }



Let's say my Controller gets a parameter "sort" (which is a property on my FlatFoo)

"Foo1Age" .....

How can I get a string "Foo.Age" from it?

Basically I need to send flattened property name to Dynamic LINQ (which accepts "Foo.Age")...

Can I use ValueInjecter helper classes to do this?

Jun 7, 2012 at 3:35 PM

I asked more concrete question on StackOverflow.

Jun 7, 2012 at 5:37 PM

yes, you can look in the source code of the Flat/Unflat injection