Serialization rocks.....


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No problem Smile
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Got it Ben.

Thanks a lot!

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
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 ?

Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
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......

Keith Chisarik
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I'm really jealous right now.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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...)

Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
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.

Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search