Monday, September 27, 2010

In the view state to save custom objects


Background:
B / S three-tier structure of the system, the performance level in the instance of business object layer, and use this object to the implementation of business rules, access the data layer.

Question:
In the performance of a business object instance, this object was found in the operation that it can not be added to the ViewState, the prompt error:

Type "AmmeterChg" must be marked as Serializable or have ReferenceConverter outside the TypeConverter, in order to be placed in view state.

Solution:

By class implements ISerialization interface, it can be serialized

Implement the interface part of the code is as follows:


# Region ISerializable Members

protected ammeterChg (SerializationInfo info, StreamingContext context)
(
this.customer_id = info.GetString ("customer_id");
this.am_id_old = info.GetString ("am_id_old");
this.abc = info.GetString ("abc");
this.ycbds_old = info.GetDouble ("ycbds_old");
)

public void GetObjectData (System.Runtime.Serialization.SerializationInfo info,

System.Runtime.Serialization.StreamingContext context)
(

info.AddValue ("customer_id", customer_id);
info.AddValue ("am_id_old", am_id_old);
info.AddValue ("abc", abc);
info.AddValue ("ycbds_old", ycbds_old);
)
# Endregion

================================================== =========
customer_id, am_id_old, ycbds_old is private property class variables!








Recommended links:



DAT to MPEG



P2P popular series of four



2002 will go more Detailed steps



VOB to FLV



Kaspersky Lab set up regional offices in Canada



3DMax Done Using NURBS Baseball Bat



Hot Desktop



page TURNING 2



Fireworks in the production of glass jar



The most beloved of five welfare workers



Landscape engineering company in Yantai in hand Weaver



ARTICLES about Remote Computing



STORM infringement advice to the court sentenced the company abandoned online play



DV to AVI



No comments:

Post a Comment