DataRows Not Serializable In 2.0
Mar 14, 2011My application uses DataRows and they are not serializable. Is there any workaround for the same?
View 1 RepliesMy application uses DataRows and they are not serializable. Is there any workaround for the same?
View 1 RepliesI am populating DataRows in a Datatable using an SQL query. How can I population the first row with a C_ID value of 0000 and C_Name field with "Select" ?
[code]...
I want to make some check before I add a list of data
so I create a temp table
[Code]....
and this is the qeury I retrive from DataBase
[Code]....
so now I get 2 data resultI just want to knowhow to compare these 2 data result?
[Code]....
then now allow to add new data...
I need to add rows to an existing (maybe) datatable in a dataset that combines the IIS6 index search with my own sql table. I keep getting object reference errors.
[Code]....
IEnumerable<DataRow> query = (from obj1 in objeDC.tmpPolicyRenewals.AsEnumerable()
where obj1.AgentCode == "Admin"
select new
{
obj1.Product,
obj1.PolicyNo,
obj1.Insured,
obj1.EffDate,
obj1.ExpDate,
obj1.GrossPrem,
obj1.Status
}) as IEnumerable<DataRow>;
Getting null value. whats error ?
How can check whether a instance is marked as serializable?
View 4 RepliesI am changing my ASP.NET app to use a web farm. To do this, I need to change the session state from in-proc to a State Server. To do this, it is my understanding that the classes that are used must be marked as serializable. How can you tell if that is possible with a class? Will you get an error at compile time if it is not possible?
View 2 RepliesI follow the code snippet to calculate Session size. Profile Memory Usage of Session State ASP.Net My problem is some properties of objects aren't marked as Serializable so I cannot apply the solution. Can I just bypass non-serializable properties?
View 1 RepliesI'm a little green when it comes to streaming and serialization...but what i wanna do is make the Upload method on the server return a serializable object to the client (it is void right now). I have a public class ServiceResult that i decorate with [Serializable], and a public class FileTransferService that implements IFileTransferService
[ServiceContract()]
public interface IFileTransferService
{
[OperationContract(IsOneWay = false)]
string Upload(FileTransferRequest request);
}
The implementation does its thing, and then at the end i create and serialize the object and try to return the string
return ServiceResultSerializer.SerializeAnObject(result);
On the client side i call this service using this class
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IFileTransferService")]
public interface IFileTransferService
{
// CODEGEN: Generating message contract since the wrapper name (FileTransferRequest) of message FileTransferRequest does not match the default value (Upload)
[System.ServiceModel.OperationContractAttribute(IsOneWay = false, Action = "http://tempuri.org/IFileTransferService/Upload")]
string Upload(FileTransferRequest request);
}
I'm basically taking this project found on this blog: [URL] And trying to make it return a value that the client caller can use I get an error right now that says: The operation 'Upload' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters. Which i have no idea what it means :P I think cuz im trying to change the Service paramaters.
consider the following class and struct
public class Entity {
public IdType Id {get;set;}
public string Data {get;set;}
}
[TypeConverter(IdTypeConverter))]
public struct IdType {
... any data ...
}
The IdTypeConverter can convert the IdType struct from and to string. Now, what I want is this class to be serializable for AJAX, WCF and ViewState. The senario could be a WCF web service which provides as array of Entity[] to a DataSource. And a custom control which binds to the datasource, saves this class to it's ViewState and sends the data to client side code. This could be achieved easily by simply adding a [Serializable] attribute to all serialized types. But I don't want the IdType to be serialized, but to be converted to a string. Thus the JSON representation should be
{ 'Id'=>'StringRepresentationOfId', 'Data'=>'foo' }
This would analogously be the optimal serialization for WCF and ViewState. Another solution would be to write another class
public class JsonEntity {
public JsonEntity(Entity from) {
Id = from.Id;
Data = from.Data;
}
public string Id {get;set;}
public string Data {get;set;}
}
and use this for JsonSerialization. But I don't like this, because this would imply that the control which is sending the data to the client knows about the Entity type. The actual question is: Is it possible to customize JsonSerialization with attributes without breaking WCF and ViewState serialization? DIT: An answer like "That' impossible" would satify me, since I'd stop trying.
As the title says, I want to mark a property as non serializable by the JavascriptSerializer. How can achive that ?
View 1 RepliesI have CSLA (1.x framework) objects from an existing project that I'm trying to use in a new .Net 4.0 project. The objects are being used in production and I really can't convert them to 2.x or EF without having 2 sets of objects.
In my c# webservice (when I try to run it) I am getting the following error:
To be XML serializable, types which inherit from ICollection must have an implementation of Add(objectname.object) at all levels of their inheritance hierarchy. objectname.objectList does not
implement Add(objectname.object).
Like I said these objects are CSLA objects written in vb.net. I don't know where to look on this one. Is it an issue of .Net 4.0 trying to talk to CSLA 1.x or is it a web service issue (as these objects never used web services originally)?
Does anyone have an idea about where I should look to figure out this issue? Should I suggest converting to CSLA 2.x?
Specifically we're making our application compatible with the Out Of Process Session State server where all types saved in session must be serializable. Is there a way to see at compile time that any type put into HttpSessionState is marked with the Serializable attribute. Something along the lines of this 'non-valid' code
public static void Put<T>( string key, T value ) where T : IsMarkedWitheSerializableAttribute
{
HttpContext.Current.Session[key] = value;
}