WriteXml issue

Posts   
 
    
Fromm
User
Posts: 2
Joined: 10-Sep-2008
# Posted on: 10-Sep-2008 12:00:44   

Hi there,

I’ve got an urgent problem with GenPro. I have an entity that has a EntityCollection as a property. This entity including the property is successfully fetched from the database. The EntityCollection has let’s say three items. The debugger tells me this: Debugger --> myEntiy.Offices[2].Name = “old office”;

When I try to re-assign a new entity on index 2 like

myEntity.Offices[2] = new OfficeEntity(){Name=”a new office”};

Then the debugger shows the new values as expected. Such as Debugger --> myEntity.Offices[2].Name = “a new office”;

The problem I’m having is that when I call the method myEntity.WriteXml() after the assignment, these changes don’t show up in the produced XML. It still has the old values. In this case Offices[2].Name = “old office”.

Strangely though, when I call Offices[2].WriteXml() the changes show up.

Did I miss something? I’m using WCF and it took me a while to figure out why the changes never arrive on the service. The examples above do not use WCF at all, so it should be easy to reproduce.

Hope you guys can help me out!

Version: GenPro 2.6

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 10-Sep-2008 19:11:22   

This test code works for me:

            CustomersEntity customer = new CustomersEntity("ALFKI");
            MessageBox.Show(customer.Orders[0].EmployeeId.ToString()); // 6
            customer.Orders[0] = new OrdersEntity() { EmployeeId = 2 };

            string xml;
            customer.Orders[0].WriteXml(out xml);

            OrdersEntity order = new OrdersEntity();
            order.ReadXml(xml);
            MessageBox.Show(order.EmployeeId.ToString()); // 2

Which llblgen runime library version are you using?

Fromm
User
Posts: 2
Joined: 10-Sep-2008
# Posted on: 11-Sep-2008 16:16:55   

Hi there,

thanks for the response. Unfortunately this doesn't work for me and reading values back in throws an exception.

BTW: When I read the xml I get an exception

System.NullReferenceException | Message: Object reference not set to an instance of an object. | StackTrace: at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlNode node, Dictionary2 processedObjectIDs, List1 nodeEntityReferences) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlNode node, XmlFormatAspect format) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(String xmlData)

SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll --> 2.6.8.709

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 11-Sep-2008 17:01:44   

Would you please post the xml serialization routine?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39865
Joined: 17-Aug-2003
# Posted on: 12-Sep-2008 11:47:27   

And please upgrade to the latest build of the runtime...

Frans Bouma | Lead developer LLBLGen Pro