StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Serialization rocks.....Expand / Collapse
Author
Message
Posted 09/12/2006 11:27:43 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:57:58 PM
Posts: 658, Visits: 27,148
I hadn't fully wrapped my brain around it when I attended the training. Now I have and I LOVE it. I have serialized the contents of my custom classes, listbox contents, and BO's, mostly to XML for transport to other processes or applications. If your just coming into .NET like I was, get to know serialization, you wont regret it.

Mosty as a way to learn, I have written my own (De)SerializeToXML() classes. Now that I understand it, I have no issue with shortcuts. Does a SerializeToXML method for BO's exist in the framework?

Thanks.
Post #2751
Posted 09/12/2006 11:33:16 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
The basic serialization methods on the BusinessLayer class use the BinaryFormatter instead of an XML formatter.  However, you can serialize just the data within the business object by accessing the DataTable.WriteXml() method on the CurrentDataTable property like this:

MyBO.CurrentDataTable.WriteXml(parameters...)


www.bungie.net
Post #2752
Posted 09/12/2006 12:03:19 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 7:19:27 PM
Posts: 819, Visits: 11,711
I'm really jealous right now.
Post #2753
Posted 09/12/2006 12:23:29 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:57:58 PM
Posts: 658, Visits: 27,148
Ivan George Borges (09/12/2006)
I'm really jealous right now.


Ben makes me jealous too.... someday I'll be there.

<< starts to sing poorly >>
If I could be like Ben......
Post #2754
Posted 09/13/2006 9:14:05 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 7:19:27 PM
Posts: 819, Visits: 11,711
Keith Chisarik (09/12/2006)

Ben makes me jealous too.... someday I'll be there.

Well, I'm not sure I will get to Ben's current level ... but if I do, I'm sure he will be already reading the binary code directly or something ...

Tried the serialization, think I got the idea. So, as an example, I had a field declared as System.Drawing.Bitmap in my table, to store a picture. So, that's why I had to tell the Business Object Mapper to "serialize" it, which means, convert the Object into a binary that could be saved into the sql binary field?

Then, this is what the BO Mapper is doing, letting me work with the field as a bitmap Object? And when it does it, it DEserialize it ?

Post #2810
Posted 09/14/2006 8:41:48 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
Yep, Ivan.  A property is just a combination of two methods... one to "get" the value and one to "set" the value... So, when you get the value, the "get" method takes the binary data stored within the field and deserializes it (reconstructs the Bitmap object) and hands you the object as a System.Drawing.Bitmap.  When you set the value, the "set" method then takes the Bitmap object you passed and serializes it (create a binary stream from the object data) and stores that binary data in the binary field in the business object.


www.bungie.net
Post #2816
Posted 09/14/2006 9:26:15 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 7:19:27 PM
Posts: 819, Visits: 11,711
Got it Ben.

Thanks a lot!

Post #2820
Posted 09/14/2006 9:27:12 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
No problem


www.bungie.net
Post #2821
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 3:43am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.141. 11 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.