Given two tables, Make and Model, where a make can contain many models and resulting in the following EF generated entity types...
/// <KeyProperties>
/// ID
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CarsModel", Name="Make")]
[global::System.Runtime.Serialization.DataContractAttr...
why we can't Serialize objects into Random Access file ? and on the other hand we can serialize objects into sequential access file ?
""C# does not provide a means to obtain an object’s size at runtime. This means that,
if we serialize the class, we cannot guarantee a fixed-length record size "" (from the book that i read in).
so we ca...
Is there a way to determine the generated serialVersionUID of a serialized Java object?
The problem is that I serialized an object without explicitely specifying the serialVersionUID. Now the deserialization process complains about class incompatibilities. However I didn't change the class in a way which would make it incompatible. So I...
I have a menu system that uses a drag and drop tree structure to make it easy for a user to modify. When the javascript serializes the string, it does it in the following way:
// Assume each of these items has an ID on with the respective numbers attached
Menu Item 1
+ Menu Item 2
+ Menu Item 3
+ Menu Item 4
Menu Item 5
Menu It...
Is there a way to specify that a [Flags] enumeration field in a class should be serialized as the string representation (e.g. "Sunday,Tuesday") rather than the integer value (e.g. 5)?
To be more specific, when returning the following SomeClass type in a web service, I want to get a string field named "Days" but I'm getting a numeric fie...
In the following Jackson/Java code that serializes objects into JSON, I am getting this:
{"animal":{"x":"x"}}
However, what I actually want to get is this:
{"dog":{"x":"x"}}
Is there something I can do to AnimalContainer so that I get the runtime type ("dog", "cat") of the object, instead of "animal")? (Edit: I am aware that the ...
I've been given some "XML" files that don't quite have a proper schema (I think that's the problem) and the medical device that generates them cannot be changed to generate easy-to-parse XML. (With such a tantalizingly small modification (extra wrapping Images tags around the Image entries) it would be trivial to read these files---isn't...
Currently, we serialize user's session object into database but the object changed too much lately so we decide to redesign this process. We all agree that we can't serialize the whole object and we need to save it field by field. There are 2 proposals,
Store all fields in a map and serialize the map.
Use ObjectOutputStream.putFields()...
Hello everyone,
For this method, XmlSerializer.Deserialize, what kinds of exception may be thrown? XmlException? InvalidOperationException? I did not find any exception description information from this method. My question is what kinds of exception could be thrown from this method?
http://msdn.microsoft.com/en-us/library/dsh84875.aspx...
I'm trying to serialize, and I am facing a problem with an abstact class.
I googled for an answer, and I found this blogitem.
I tried that and that work.
Ok, very nice. But check out the comment on the item:
This methodology seems to be hiding
the true problem and that is an
inaccurate implementation of OO design
patterns, na...
I'm using the following code to serialise an object:
public static string Serialise(IMessageSerializer messageSerializer, DelayMessage message)
{
using (var stream = new MemoryStream())
{
messageSerializer.Serialize(new[] { message }, stream);
return Encoding.UTF8.GetString(stream.ToArray());
}
}
Unfortuna...
Hi,
I'd like to know whether there is a way to compare two objects in MBUnit so that the test is passed when the objects "look" the same, even if those are distinct instances?
For example:
[TestFixture]
class ComparisonTestFixture
{
class foo
{
public string bar;
}
[Test]
public void Compari...
Hi all,
I am considering the use of Quantities to define a number together with its unit. This value most likely will have to be stored on the disk. As you are probably aware, pickling has one major issue: if you relocate the module around, unpickling will not be able to resolve the class, and you will not be able to unpickle the inform...
I have looked at a few JSON libraries for Java, but few of them seem to follow the same serialization pattern as core Java serialization patterns. I would like to use a native Java JSON serialization object, but in the absence of that what third party library matches Native serialization and preferably will serialize anything marked ser...
I have an XML which looks something like this
<?xml version="1.0" encoding="utf-8" ?>
<Applicant>
<NameValueGroup attribute="Name">
<NameValue desc="One" value="test1"/>
<NameValue desc="Two" value="test2"/>
<NameValue desc="Three" value="test3"/>
<NameValue desc="Four" value="test4"/>
</NameValueGroup>
<NameValueG...
I have a C# class as follows:
public class TestObj
{
private int intval;
private string stringval;
private int[] intarray;
private string[] stringarray;
//... public properties not shown here
}
I would like to serialize an instance of this class into a string.
In addition:
I will be appending this string as a Qu...
Hello!
I'd like to serialize/unserialize following classes:
class Feature{
...
virtual string str()=0;
};
template<typename T>
class GenericFeature : public Feature{
T value;
...
virtual string str();
};
I read boost.serialize docs and the sayed that you must register classes.
I can register them in constructor. But there will be p...
Given a class like this one:
[Serializable]
public class MyClass {
string name;
string address;
public MyClass(SerializationInfo info, StreamingContext context){
name = info.GetString("name");
if(/* todo: check if a value for address exists */)
address = info.GetString("address");
}
publ...
Question in title... In short - I have a WCF service exposing operations that return entity classes. The client-side classes inherit from an abstract base class instead of the default System.Object. The abstract base class has a default constructor defined. When calling one of the service methods I would expect that constructor to get ...
I would like to XML serialize an object that has (among other) a property of type IModelObject (which is an interface).
public class Example
{
public IModelObject Model { get; set; }
}
When I try to serialize an object of this class, I receive the following error:
"Cannot serialize member Example.Model of type Example because it...