How to serialize domain objects?

E

echoSwe

Hi,

I have rich domain model, in which one entity is the "Page". This
object contains a field; "ChildPages : IList<Page>" and a couple of
data-fields, like description, title, text, etc... It inherits from
AbstractPost which implements the IPost interface. AbstractPost
defines many of the common properties amongst the different types of
pages I have in the domain model.

My question is simple: How do I serialize the collection of pages my
application holds, into an xml-file such as
<pages>
<page>
<title>...</title>
[...]
</page>
<page>
[...]
</page>
</pages>

I don't want it to save to the harddrive and I need to be able to
exclude fields from being included in the xml file; hopefully so with
by using attributes. I need the xml document to do xsl transformations
on...
 
T

Thomas Hansen

Hi,

I have rich domain model, in which one entity is the "Page". This
object contains a field; "ChildPages : IList<Page>" and a couple of
data-fields, like description, title, text, etc... It inherits from
AbstractPost which implements the IPost interface. AbstractPost
defines many of the common properties amongst the different types of
pages I have in the domain model.

My question is simple: How do I serialize the collection of pages my
application holds, into an xml-file such as
<pages>
<page>
<title>...</title>
[...]
</page>
<page>
[...]
</page>
</pages>

I don't want it to save to the harddrive and I need to be able to
exclude fields from being included in the xml file; hopefully so with
by using attributes. I need the xml document to do xsl transformations
on...

Well until O2X (Object 2 XML, my companies xml serialization library)
are being released there's not really many alternatives other than
SoapFormatter...
google for "dotnet soapformatter" nd you'll be home free...
It carries LOADS of overhead though due to the "SOAP" part... ;)

..t
 
G

Guest

If your hierarchy is indeed serializable and the excluded fields are so
attributed, you should be able to pass it into the XmlSerializer and get what
you want.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top