Пример #1
0
        private static T Deserialize <T>(
            DescribedSerializationBase describedSerialization)
        {
            var result = describedSerialization.DeserializePayload <T>();

            return(result);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subject"/> class.
 /// </summary>
 /// <param name="describedSerialization">A described serialization of the subject.</param>
 /// <param name="summary">A string summary of the subject.</param>
 public Subject(
     DescribedSerializationBase describedSerialization,
     string summary)
 {
     this.DescribedSerialization = describedSerialization ?? throw new ArgumentNullException(nameof(describedSerialization));
     this.Summary = summary ?? LogHelper.NullSubjectSummary;
 }
Пример #3
0
        public static T DeserializePayload <T>(
            this DescribedSerializationBase describedSerialization,
            VersionMatchStrategy assemblyVersionMatchStrategy = VersionMatchStrategy.AnySingleVersion)
        {
            var result = describedSerialization.DeserializePayloadUsingSpecificFactory <T>(
                SerializerFactory.Instance,
                assemblyVersionMatchStrategy);

            return(result);
        }
Пример #4
0
        private static void RunVerification <T>(
            DescribedSerializationBase describedSerialization,
            RoundtripSerializationVerification <T> verificationCallback,
            AppDomainScenarios appDomainScenario,
            T deserializedObject)
        {
            new { verificationCallback }.AsArg().Must().NotBeNull();

            try
            {
                verificationCallback(describedSerialization, deserializedObject);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException(Invariant($"Failed to roundtrip specified object to/from {describedSerialization.SerializerRepresentation.SerializationKind} {describedSerialization.GetSerializationFormat()} using {describedSerialization.SerializerRepresentation.SerializationConfigType.ResolveFromLoadedTypes().ToStringReadable()} with the App Domain Scenario '{appDomainScenario}'.  Serialized payload is: {describedSerialization.GetSerializedPayloadAsEncodedString()}.  Deserialized object is: {deserializedObject}."), ex);
            }
        }