CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
SerializationFormatterFactory.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="SerializationFormatterFactory.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Factory used to create the appropriate</summary>
7//-----------------------------------------------------------------------
8using System;
10using Csla.Reflection;
11
12namespace Csla.Serialization
13{
19 public static class SerializationFormatterFactory
20 {
24 public static ISerializationFormatter GetFormatter()
25 {
26#if !NET5_0
27 if (ApplicationContext.SerializationFormatter == ApplicationContext.SerializationFormatters.BinaryFormatter)
28 return new BinaryFormatterWrapper();
29#if !NETSTANDARD2_0
30 else if (ApplicationContext.SerializationFormatter == ApplicationContext.SerializationFormatters.NetDataContractSerializer)
31 return new NetDataContractSerializerWrapper();
32#endif
33 else
34#endif
35 if (ApplicationContext.SerializationFormatter == ApplicationContext.SerializationFormatters.CustomFormatter)
36 {
37 string customFormatterTypeName = ConfigurationManager.AppSettings["CslaSerializationFormatter"];
38 return (ISerializationFormatter)MethodCaller.CreateInstance(Type.GetType(customFormatterTypeName, true, true));
39 }
40 else
42 }
43 }
44}
Serializes and deserializes objects at the field level.