We use Microsoft ERP, which dynamically provides web services. Services generated by the service are beyond our control. We cannot say how objects are created and displayed, including type definitions. When a new method is added or removed from the web service, all type enumerations are numbered, and everything that uses the web service is hidden after updating to the new definitions. In fact,
enumeration Type1
Item1
Item2
Item3
... can be
enumeration Type6
Item1
Item2
Item3
... with a change in the name of the enumeration type, but the type members remain static. The service displays a service that looks exactly like the end result of using XSD.exe to generate objects. Thus, every time someone exposes a new method in a service (via the ERP graphical interface), objects are rebuilt, types are assigned to service definitions in alphabetical order, overexposed, leaving the entire basic code fragment.
I tried using reflection to determine the type, and then parse the static member in the new business object, but this does not work because I cannot type an enumeration cast without knowing the actual type name. The following will not work.
System.Type t = service.BusinessObjectEnumeration.GetType();
service.SomeField = Enum.Parse(t,"Item1");
... because the compiler throws an error because I did not explicitly list it.
, ?
, , , , .