Пример #1
0
        private object DeserializeActivity(Activity rootActivity, Guid id)
        {
            string filename = GetFileName(id);
            object result;

            IFormatter formatter = new BinaryFormatter();
            formatter.SurrogateSelector = ActivitySurrogateSelector.Default;

            using (C1FileStream stream = new C1FileStream(filename, FileMode.Open))
            {
                result = Activity.Load(stream, rootActivity, formatter);
                stream.Close();
            }

            // Log.LogVerbose(LogTitle, $"Workflow loaded. Id = {id}, Type = {result.GetType()}");

            return result;
        }
        private void SerializeActivity(Activity rootActivity, Guid id)
        {
            if (!ActivityIsSerializable(rootActivity))
            {
                LoggingService.LogVerbose("FileWorkFlowPersisetenceService", string.Format("The workflow does not support persiting. Id = {0}, Type = {1}", id, rootActivity.GetType()));
                return;
            }

            string filename = GetFileName(id);

            IFormatter formatter = new BinaryFormatter();
            formatter.SurrogateSelector = ActivitySurrogateSelector.Default;

            using (C1FileStream stream = new C1FileStream(filename, FileMode.OpenOrCreate))
            {
                rootActivity.Save(stream, formatter);
                stream.Close();
            }

            // LoggingService.LogVerbose("FileWorkFlowPersisetenceService", string.Format("Workflow persisted. Id = {0}, Type = {1}", id, rootActivity.GetType()));
        }
Пример #3
0
        private void SerializeActivity(Activity rootActivity, Guid id)
        {
            if (!ActivityIsSerializable(rootActivity))
            {
                Log.LogVerbose(LogTitle,
                    $"The workflow does not support persiting. Id = {id}, Type = {rootActivity.GetType()}");
                return;
            }

            string filename = GetFileName(id);

            IFormatter formatter = new BinaryFormatter();
            formatter.SurrogateSelector = ActivitySurrogateSelector.Default;

            using (C1FileStream stream = new C1FileStream(filename, FileMode.OpenOrCreate))
            {
                rootActivity.Save(stream, formatter);
                stream.Close();
            }

            // Log.LogVerbose(LogTitle, $"Workflow persisted. Id = {id}, Type = {rootActivity.GetType()}");
        }
        private object DeserializeActivity(Activity rootActivity, Guid id)
        {
            string filename = GetFileName(id);
            object result;

            IFormatter formatter = new BinaryFormatter();
            formatter.SurrogateSelector = ActivitySurrogateSelector.Default;

            using (C1FileStream stream = new C1FileStream(filename, FileMode.Open))
            {
                result = Activity.Load(stream, rootActivity, formatter);
                stream.Close();
            }

            // LoggingService.LogVerbose("FileWorkFlowPersisetenceService", string.Format("Workflow loaded. Id = {0}, Type = {1}", id, result.GetType()));

            return result;
        }