protected override object CoreGetSourceObject(string sourceFilePath, IDictionary<string, IList<string>> properties)
		{
			IXmlPersistEngine xpe;
			object retval;

			xpe = this.GetXmlPersistEngine(properties);

			if ((object)sourceFilePath == null)
				throw new ArgumentNullException(nameof(sourceFilePath));

			if ((object)properties == null)
				throw new ArgumentNullException(nameof(properties));

			if (SolderLegacyInstanceAccessor.DataTypeFascadeLegacyInstance.IsWhiteSpace(sourceFilePath))
				throw new ArgumentOutOfRangeException(nameof(sourceFilePath));

			if ((object)xpe == null)
				throw new InvalidOperationException(nameof(xpe));

			sourceFilePath = Path.GetFullPath(sourceFilePath);

			retval = new XpeSerializationStrategy(xpe).GetObjectFromFile<object>(sourceFilePath);

			return retval;
		}
        protected override void CoreWriteObject(object obj, string objectName)
        {
            IXmlObject xmlObject;
            ITextSerializationStrategy serializationStrategy;

            if ((object)obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            xmlObject = obj as IXmlObject;

            // this should support XPE, XML, JSON

            /*
             *      BACKLOG([email protected] / 2015 - 12 - 18):
             *      Refactor this logic that is common between this File and TextWriter Outputs.
             */
            if ((object)xmlObject != null)
            {
                serializationStrategy = new XpeSerializationStrategy(this.Xpe);
            }
            else if ((object)SolderFascadeAccessor.ReflectionFascade.GetOneAttribute <XmlRootAttribute>(obj.GetType()) != null)
            {
                serializationStrategy = new XmlSerializationStrategy();
            }
            else
            {
                serializationStrategy = new JsonSerializationStrategy();
            }

            serializationStrategy.SetObjectToWriter(this.CurrentTextWriter, obj);
        }
Esempio n. 3
0
        protected override object CoreGetSourceObject(string sourceFilePath, IDictionary <string, IList <string> > properties)
        {
            IXmlPersistEngine xpe;
            object            retval;

            xpe = this.GetXmlPersistEngine(properties);

            if ((object)sourceFilePath == null)
            {
                throw new ArgumentNullException(nameof(sourceFilePath));
            }

            if ((object)properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (SolderFascadeAccessor.DataTypeFascade.IsWhiteSpace(sourceFilePath))
            {
                throw new ArgumentOutOfRangeException(nameof(sourceFilePath));
            }

            if ((object)xpe == null)
            {
                throw new InvalidOperationException(nameof(xpe));
            }

            sourceFilePath = Path.GetFullPath(sourceFilePath);

            retval = new XpeSerializationStrategy(xpe).GetObjectFromFile <object>(sourceFilePath);

            return(retval);
        }
Esempio n. 4
0
        protected override void CoreWriteObject(object obj, string objectName)
        {
            string                 fullFilePath;
            IXmlObject             xmlObject;
            ISerializationStrategy serializationStrategy;

            if ((object)obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if ((object)objectName == null)
            {
                throw new ArgumentNullException(nameof(objectName));
            }

            if (SolderFascadeAccessor.DataTypeFascade.IsWhiteSpace(objectName))
            {
                throw new ArgumentOutOfRangeException(nameof(objectName));
            }

            fullFilePath = Path.GetFullPath(Path.Combine(this.BaseDirectoryPath, objectName));
            xmlObject    = obj as IXmlObject;

            // this should support XPE, XML, JSON

            /*
             *      BACKLOG([email protected] / 2015 - 12 - 18):
             *      Refactor this logic that is common between this File and TextWriter Outputs.
             */
            if ((object)xmlObject != null)
            {
                serializationStrategy = new XpeSerializationStrategy(this.Xpe);
            }
            else if ((object)SolderFascadeAccessor.ReflectionFascade.GetOneAttribute <XmlRootAttribute>(obj.GetType()) != null)
            {
                serializationStrategy = new XmlSerializationStrategy();
            }
            else
            {
                serializationStrategy = new JsonSerializationStrategy();
            }

            serializationStrategy.SetObjectToFile(fullFilePath, obj);
        }
		protected override void CoreWriteObject(object obj, string objectName)
		{
			IXmlObject xmlObject;
			ITextSerializationStrategy serializationStrategy;

			if ((object)obj == null)
				throw new ArgumentNullException(nameof(obj));

			xmlObject = obj as IXmlObject;

			// this should support XPE, XML, JSON
			/*
				BACKLOG([email protected] / 2015 - 12 - 18):
				Refactor this logic that is common between this File and TextWriter Outputs.
			*/
			if ((object)xmlObject != null)
				serializationStrategy = new XpeSerializationStrategy(this.Xpe);
			else if ((object)SolderLegacyInstanceAccessor.ReflectionFascadeLegacyInstance.GetOneAttribute<XmlRootAttribute>(obj.GetType()) != null)
				serializationStrategy = new XmlSerializationStrategy();
			else
				serializationStrategy = new JsonSerializationStrategy();

			serializationStrategy.SetObjectToWriter(this.CurrentTextWriter, obj);
		}
Esempio n. 6
0
		protected override void CoreWriteObject(object obj, string objectName)
		{
			string fullFilePath;
			IXmlObject xmlObject;
			ISerializationStrategy serializationStrategy;

			if ((object)obj == null)
				throw new ArgumentNullException(nameof(obj));

			if ((object)objectName == null)
				throw new ArgumentNullException(nameof(objectName));

			if (SolderLegacyInstanceAccessor.DataTypeFascadeLegacyInstance.IsWhiteSpace(objectName))
				throw new ArgumentOutOfRangeException(nameof(objectName));

			fullFilePath = Path.GetFullPath(Path.Combine(this.BaseDirectoryPath, objectName));
			xmlObject = obj as IXmlObject;

			// this should support XPE, XML, JSON
			/*
				BACKLOG([email protected] / 2015 - 12 - 18):
				Refactor this logic that is common between this File and TextWriter Outputs.
			*/
			if ((object)xmlObject != null)
				serializationStrategy = new XpeSerializationStrategy(this.Xpe);
			else if ((object)SolderLegacyInstanceAccessor.ReflectionFascadeLegacyInstance.GetOneAttribute<XmlRootAttribute>(obj.GetType()) != null)
				serializationStrategy = new XmlSerializationStrategy();
			else
				serializationStrategy = new JsonSerializationStrategy();

			serializationStrategy.SetObjectToFile(fullFilePath, obj);
		}