Hi Guys,
I have to say I love LLBLGen. I have used it for one project now, but I like to use it on the next as well. My next project is based on IBF (Infromation Bridge Framework). IBF relies on XML and webservices.
When I follow the guidelines of Microsoft IBF development guide on http://www.microsoft.com/technet/itsolutions/cits/iwp/ibf/soldev/moibf1_sdg_08.mspx, I have to create xml classes for each of my entities. Luckily LLBLGen build these for me. Unfortunately the xml generated with LLBLGen is much to complex. Is it possible to generate a simple xml variant.
LLBLGen output:
<CustomerEntity CustomerID="1">
<ObjectID>a21d5b32-a843-4365-9b30-d9506b67ad81</ObjectID>
<IsNew>False</IsNew>
<Fields>
<CustomerID>
<CurrentValue>1</CurrentValue>
<DbValue>1</DbValue>
<IsChanged>False</IsChanged>
<IsNull>False</IsNull>
</CustomerID>
</Fields>
<IsDirty>False</IsDirty>
<EntityState>Fetched</EntityState>
<SavedFieldSets />
</CustomerEntity>
Wanted output:
<?xml version="1.0" ?>
<Customer xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="Customer-Data">
<CustomerID>1</CustomerID>
</Customer>
Possible solution is building an extra entityclass
[XmlRoot("Customer",Namespace="Customer-Data",IsNullable=false)]
[XmlType("Customer", Namespace="Customer-Data")]
public class Customer
{
private int _CustomerID;
[XmlElement]
public int CustomerID
{
get{return this._CustomerID;}
set{this._CustomerID = value;}
}
}
Copy all fields and serialize the extra entityclass
IBFDemo.EntityClasses.CustomerEntity customerEntity;
customerEntity = new IBFDemo.EntityClasses.CustomerEntity(1);
Customer customer = new Customer();
customer.CustomerID = customerEntity.CustomerID;
System.Xml.Serialization.XmlSerializer serialize = new System.Xml.Serialization.XmlSerializer(typeof(Customer));
serialize.Serialize(Response.OutputStream, customer);
Response.End();
I don’t like this solution cause it generates to much work. I just want to use the LLBLGen classes and give a correct an simple xml output.
Mike