示例#1
0
        protected override void OnLoading(ElsaContext dbContext, WorkflowInstance entity)
        {
            var data = new
            {
                entity.Input,
                entity.Output,
                entity.Variables,
                entity.ActivityData,
                entity.Metadata,
                entity.BlockingActivities,
                entity.ScheduledActivities,
                entity.Scopes,
                entity.Fault,
                entity.CurrentActivity
            };

            var json = (string)dbContext.Entry(entity).Property("Data").CurrentValue;

            if (!string.IsNullOrWhiteSpace(json))
            {
                data = JsonConvert.DeserializeAnonymousType(json, data, DefaultContentSerializer.CreateDefaultJsonSerializationSettings()) !;
            }

            entity.Input               = data.Input;
            entity.Output              = data.Output;
            entity.Variables           = data.Variables;
            entity.ActivityData        = data.ActivityData;
            entity.Metadata            = data.Metadata;
            entity.BlockingActivities  = data.BlockingActivities;
            entity.ScheduledActivities = data.ScheduledActivities;
            entity.Scopes              = data.Scopes;
            entity.Fault               = data.Fault;
            entity.CurrentActivity     = data.CurrentActivity;
        }
        protected override void OnSaving(ElsaContext dbContext, WorkflowDefinition entity)
        {
            var data = new
            {
                entity.Activities,
                entity.Connections,
                entity.Variables,
                entity.ContextOptions,
                entity.CustomAttributes
            };

            var json = _contentSerializer.Serialize(data);

            dbContext.Entry(entity).Property("Data").CurrentValue = json;
        }
示例#3
0
        protected override void OnSaving(ElsaContext dbContext, WorkflowInstance entity)
        {
            var data = new
            {
                entity.Output,
                entity.Variables,
                entity.ActivityData,
                entity.BlockingActivities,
                entity.ScheduledActivities,
                entity.Scopes,
                entity.Fault,
                entity.CurrentActivity
            };

            var json = _contentSerializer.Serialize(data);

            dbContext.Entry(entity).Property("Data").CurrentValue = json;
        }
        protected override void OnLoading(ElsaContext dbContext, WorkflowDefinition entity)
        {
            var data = new
            {
                entity.Activities,
                entity.Connections,
                entity.Variables,
                entity.ContextOptions,
                entity.CustomAttributes
            };

            var json = (string)dbContext.Entry(entity).Property("Data").CurrentValue;

            data = JsonConvert.DeserializeAnonymousType(json, data, DefaultContentSerializer.CreateDefaultJsonSerializationSettings());

            entity.Activities       = data.Activities;
            entity.Connections      = data.Connections;
            entity.Variables        = data.Variables;
            entity.ContextOptions   = data.ContextOptions;
            entity.CustomAttributes = data.CustomAttributes;
        }