FieldDataManager Reflection

FieldDataManager Reflection

Old forum URL: forums.lhotka.net/forums/t/10370.aspx


kriya posted on Friday, May 13, 2011

How do I get the child object fields from parent BusinessBase using Reflection?.I have an BO Customer and want to replace   the Primary key value of BO CustomerOrder to New GUID and save that record .I m using CSLA 3.0.

 m not geting the properties of FieldDataManager .Any Solution?

Type t = Customer.GetType();

      FieldInfo field= t.GetField("_cutomerOrder",

        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

      object fieldDataManager = property.GetValue(Customer);

Thanks in Advance.

RockfordLhotka replied on Friday, May 13, 2011

CSLA 3.0 didn't have the field manager. You must be using 3.6 or higher?

The purpose of the field manager is to help you (and me) avoid the use of reflection for things like this. There's a method on the field manager that will give you a list of the child properties in your business object.

The child object can ask its field manager for its list of properties, and that list can be returned through an internal method.

That would allow the parent to get a list of the child object's properties without using any reflection at all.

Copyright (c) Marimer LLC