Hi,
I'm using LLBLGen 2.6.11.0427
Code generated with adapter templates
I have something like this:
[Serializable]
[DataContract]
public class Currency
{
[DataMember]
public string Code { get; protected set; }
[DataMember]
public string Name { get; protected set; }
protected Currency()
{
}
public Currency(string code, string name)
{
Code = code;
Name = name;
}
}
public partial class LLBLGenGeneratedEntity
{
public Currency Currency {get;set;}
}
When I do :
var x = new LLBLGenGeneratedEntity() { Currency = new Currency("A", "A")};
string xml = null;
x.WriteXml(XmlFormatAspect.Compact25, out xml);
var clone = new LLBLGenGeneratedEntity();
clone.ReadXml(xml);
I get:
System.ArgumentException : Object of type 'System.String' cannot be converted to type Namespace.Currency'.
This because LLBLGen serialies the Currency as:
<Currency>Namespace.Currency</Currency>
It does however work when I first persist the entity and then load it.
How do I make LLBLGen correctly serialize entities that were not previously persisted .
Regards,
Robert.