473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to serialize domain objects?

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...

Feb 3 '07 #1
2 1234
On Feb 3, 5:27 pm, echo...@gmail.com wrote:
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

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

Feb 3 '07 #2
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

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"ec*****@gmail.com" wrote:
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...

Feb 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Sleeman | last post by:
Hi all, i just spent an hour rifling through code to find the cause of a problem only to find it's an oddity with serialization and recursive objects, so figured I'd post for the next person who...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
5
by: Julia | last post by:
Hi, I need to serialize an object in such a way that it can be passed as parameter in a URL http://www.domain.com?object=%d793btng.... I did some reading and I came to the conclusion that I...
2
by: films | last post by:
I understand the concept. Serialization of a class will add all the sub-objects of the class to the stream if there are also serializible. So say I have: class Author {
2
by: Dave | last post by:
I have an application running on a 3 server webfarm running Windows 2003 with SQLServer Session state. After running for several hours, I started getting the following error. When I access each...
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
4
by: =?Utf-8?B?Qnlyb24=?= | last post by:
When I try to serialize an instance of the LocationCell below (note Building field) I get an error in the reflection attempt. If I remove the _Building field it serializes fine. I tried renaming...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.