Allows to easily save and recreate binary data objects with the full type names like other
Serializers, but way faster (100x). Before reconstructing types load all needed assemblies.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Core BinaryDataExtensions
Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The BinaryDataExtensions type exposes the following members.
Methods
Name | Description | |
---|---|---|
Create |
Loads a binary data object and reconstructs the object based on the saved type information.
View code on GitHub | |
CreateFromMemoryStream | ||
GetTypeFromShortNameOrFullNameIfNotFound | ||
LoadDataWithKnownTypeFromMemoryStream DataType | ||
LoadKnownTypeWithoutVersionCheck DataType | ||
Save |
Saves any object type information and the actual data contained in in, use Create to load.
View code on GitHub | |
SaveDataIntoMemoryStream DataType | ||
SaveToMemoryStream | ||
ToBinaryData | ||
ToByteArray | ||
ToByteArrayWithLengthHeader | ||
ToByteArrayWithTypeInformation |
Remarks
Examples
[Test] public void DynamicallyCreatedTypeIsNotStored() { var unknownObject = new ExpandoObject(); Assert.Throws<BinaryDataExtensions.NoShortNameStoredFor>( () => BinaryDataExtensions.GetShortName(unknownObject)); }
[Test] public void BuiltInTypeGetShortName() { const int Value = 0; Assert.AreEqual("Int32", BinaryDataExtensions.GetShortName(Value)); }
[Test] public void CannotSaveObjectDataIfNull() { var binaryWriter = new BinaryWriter(new MemoryStream()); Assert.Throws<ArgumentNullException>(() => BinaryDataExtensions.Save(null, binaryWriter)); }
See Also