/// <summary>
 /// Initializes a new instance of the <see cref="XTypeMapperSerializer"/> class.
 /// </summary>
 /// <param name="pTypeMappings">The dictionnary of type to map (old type to new type).</param>
 /// <param name="pExternalReferenceResolver">An external reference resolver.</param>
 /// <param name="pDiscoverContracts">Set to true to discovert new contracts.</param>
 /// <param name="pMissingTypesDirPath">The directory path of the missing type deug file.</param>
 public XTypeMapperSerializer(Dictionary <string, string> pTypeMappings, IXExternalReferenceResolver pExternalReferenceResolver = null, bool pDiscoverContracts = true, string pMissingTypesDirPath = null)
     : base(pExternalReferenceResolver, pDiscoverContracts)
 {
     this.mTypeMappings = new Dictionary <string, string>();
     this.InitializeTypeMappings(pTypeMappings);
     this.mMultiTypeReferences = new Dictionary <string, string>();
     this.mMissingTypesDirPath = pMissingTypesDirPath;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="XTypeMapperSerializer"/> class.
 /// </summary>
 /// <param name="pTypeMappings">The dictionnary of type to map (old type to new type).</param>
 /// <param name="pExternalReferenceResolver">An external reference resolver.</param>
 /// <param name="pDiscoverContracts">Set to true to discovert new contracts.</param>
 /// <param name="pMissingTypesDirPath">The directory path of the missing type deug file.</param>
 public XTypeMapperSerializer(Dictionary<string, string> pTypeMappings, IXExternalReferenceResolver pExternalReferenceResolver = null, bool pDiscoverContracts = true, string pMissingTypesDirPath = null)
     : base(pExternalReferenceResolver, pDiscoverContracts)
 {
     this.mTypeMappings = new Dictionary<string, string>();
     this.InitializeTypeMappings(pTypeMappings);
     this.mMultiTypeReferences = new Dictionary<string, string>();
     this.mMissingTypesDirPath = pMissingTypesDirPath;
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XSerializer"/> class.
        /// </summary>
        /// <param name="pExternalReferenceResolver">An external reference resolver.</param>
        /// <param name="pDiscoverContracts">Set to true to discovert new contracts.</param>
        public XSerializer(IXExternalReferenceResolver pExternalReferenceResolver = null, bool pDiscoverContracts = true)
        {
            if (pExternalReferenceResolver == null)
            {
                this.ExternalReferenceResolver = new DefaultExternalReferenceResolver();
            }
            else
            {
                this.ExternalReferenceResolver = pExternalReferenceResolver;
            }

            this.InternalReferenceExcludedType = new List <string>();

            if (pDiscoverContracts)
            {
                foreach (var lContract in SerializationContractManager.Instance.Contracts)
                {
                    this.mContracts.Add(lContract);
                }
            }
            this.mNullContract = SerializationContractManager.Instance.Contracts.FirstOrDefault(pElt => pElt is NullValueSerializationContract) as NullValueSerializationContract;
        }