473,804 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization issue

We are using ACAServices in our project, and are passing entity classes as
parameters to the ACAServiceMetho d. We are using a private variable
entityState to indicate whether the entity is new/updated and so on. At
present we are not using any custom serialization in our project, we just
decorate the entity class with “Serializable ” attribute as shown below:

[Serializable]

public class Address

{

private string _street;

private string _city;

private entityState;

public string Street

{

get { return _street; }

set

{

if (_street != value)

{

this.entityStat e = “modified”;

}

_street = value;

}

}

When this ACAServiceMetho d is called, deserialization happens. Taking above
entity as a sample, when deserialization occurs, street is null and value is
suppose “WALL STREET”, then the if condition is satisfied and the entityState
property always gets set to “modified”. We wish to maintain the state of the
object as it was stored during serialization.

We are aware that there is some way by which we can decorate a web service
with certain attributes. These attributes force the ACAService to implement
custom serialization / deserialization methods. However we are not able to
find any documentation which gives exact implementation details.

Let me elaborate a little more on our entity class design. In our case, we
have an EntityBase class, which contains properties such as ID and so on. All
the entities inherit from the EntityBase class. The entityState mentioned
below is actually part of our EntityBase class.

Does anyone have a sample for implementing this, or any other solution for
this problem?

Apr 5 '06 #1
1 1900
The problem is there is now way to serialize a private field. The
serialization process of the webservices usses reflection to go over all of
the entity public fields and serialize them. reflection cannot access the
values of private fields so you cannot use any of the serialization
attributes to force the serialization of your state field. I'm attaching a
link to an artical that explains all of the attributes of xml serialization
which is used in web services:
http://www.topxml.com/xmlserializer/serializer.pdf
--
GuyBar
"Rucha" wrote:
We are using ACAServices in our project, and are passing entity classes as
parameters to the ACAServiceMetho d. We are using a private variable
entityState to indicate whether the entity is new/updated and so on. At
present we are not using any custom serialization in our project, we just
decorate the entity class with “Serializable ” attribute as shown below:

[Serializable]

public class Address

{

private string _street;

private string _city;

private entityState;

public string Street

{

get { return _street; }

set

{

if (_street != value)

{

this.entityStat e = “modified”;

}

_street = value;

}

}

When this ACAServiceMetho d is called, deserialization happens. Taking above
entity as a sample, when deserialization occurs, street is null and value is
suppose “WALL STREET”, then the if condition is satisfied and the entityState
property always gets set to “modified”. We wish to maintain the state of the
object as it was stored during serialization.

We are aware that there is some way by which we can decorate a web service
with certain attributes. These attributes force the ACAService to implement
custom serialization / deserialization methods. However we are not able to
find any documentation which gives exact implementation details.

Let me elaborate a little more on our entity class design. In our case, we
have an EntityBase class, which contains properties such as ID and so on. All
the entities inherit from the EntityBase class. The entityState mentioned
below is actually part of our EntityBase class.

Does anyone have a sample for implementing this, or any other solution for
this problem?

Apr 6 '06 #2

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

Similar topics

37
5028
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined signature. When developing this lib, I figured that the pointer-to-member-function, although seemingly an attractive solution, does not work well for us.
2
6216
by: Dominic | last post by:
Hi everybody, I'm planning to use serialization to persist an object (and possibly its child objects) in my application. However, I'm concerned about the backward compatibility issue. I'm evaluating if we can easily resolve this issue. For example, I have a class MyClass consisting of 100 fields.
6
2719
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or rmi. Just to keep my question short I am posting trimmed version of my code. //file: Serializable.cs
3
2876
by: Steve | last post by:
I've been following a couple remoting tutorials on the web, they are all pretty much the same. I've got my different applications built(client, server and remote object (dll)) The client is able to get a reference to the remote object and that works fine. When I try to make a call to a remote object's method I get an exception: System.Runtime.Serialization.SerializationException: Cannot find the assembly ProcessTest,...
5
2123
by: George Ter-Saakov | last post by:
I have 2 classes one is document and another is collection of documents. When i am trying to use XmlSerializer to serialize class which has clsDcoumentIds member variable i am getting an exception "System.InvalidOperationException: The type clsDocumentId was not expected." public class clsDocumentId { string _sDocumentId; public clsDocumentId() {}
7
1797
by: Joe | last post by:
I've tracked the performance issue down to a single class. This class derives from CollectionBase and stores a basic value type such as string, int, double, etc... I also store the type itself which you can see I'm using when calling AddValue. I implemented ISerializable and GeteObjectData. Here's what I tried: for (int i = 0; i < this.Count; i++) info.AddValue("item" + i.ToString(), this, typeof(type) );
1
11113
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
2
9646
by: compurhythms | last post by:
I have a .NET Windows Service that needs to run without interruption for long periods of time (weeks or months). Everything works great except that every once in a great while I get the following type of exception when reading data from a file via XML Serialization: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\TEMP \muodpwwm.dll'. (see rest of call stack below). The problem is that the serialization works for...
3
1531
by: girish574 | last post by:
After the integration of boost serialization code, the exceptions are not at all getting caught in my application. Im building on RHEL4 kernel 2.6.9-42.ELsmp and gcc version is 4.0.2. The application terminates when exception is thrown. Removing the serialization code makes the exceptions getting caught. The worst part is im not able to reproduce the scenario in a small program.
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.