how can I control WriteXML

Posts   
 
    
BOb
User
Posts: 12
Joined: 29-Jun-2005
# Posted on: 25-Oct-2005 14:41:33   

I want to create a web service that looks as follows

[WebMethod] public AddressesEntity GetAddress (int id) { address = new EntityClasses.AddressesEntity(); address.FetchUsingPK(1);

      return address
 }

I would like the returned xml to look (roughly) like the following

<AddressEntity> <Id type="int">int</Id> <Name type="string" length="30">string</Name> </AddressEntity>

Is there a way I can do this directly from the entity class without getting all of the join (and other) information. I have tried XmlFormatAspect.Compact but it still has too much 'fluff'.

Could you add another XmlFormatAspect - perhaps that just returns the datacolumns \ types \ data in the entity ?

Will my only solution be to roll my own ? I was hoping to avoid that but if I have to ....

Thanks

BOb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Oct-2005 14:53:13   

At the moment there's no aspect for that, for the reason taht you lose change tracking and other info for the entity, so the entity can't be reconstructed from the data.

If you don't care about that you can call entity.Fields.WriteXml(), by passing in a valid XmlDocument, the rootnode and aspects. This will produce only xml for the fields. It still contains xml which isn't used by you, but you don't get the entity native fluff. You can either use that, use an xsl to convert it, or roll your own for the time being.

Frans Bouma | Lead developer LLBLGen Pro