internal static TaskAggregateStoreObject FromDarTaskAggregate(DarTaskAggregate taskAggregate, StoreObjectProvider objectProvider) { if (taskAggregate == null) { throw new ArgumentNullException("taskAggregate"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } TaskAggregateStoreObject taskAggregateStoreObject = taskAggregate.WorkloadContext as TaskAggregateStoreObject; if (taskAggregateStoreObject == null) { taskAggregateStoreObject = objectProvider.FindByAlternativeId <TaskAggregateStoreObject>(taskAggregate.Id); if (taskAggregateStoreObject == null) { taskAggregateStoreObject = new TaskAggregateStoreObject(); } } if (taskAggregateStoreObject != null) { taskAggregateStoreObject.UpdateFromDarTaskAggregate(taskAggregate); } return(taskAggregateStoreObject); }
public DarTaskAggregate ToDarTaskAggregate(DarServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } DarTaskAggregate darTaskAggregate = serviceProvider.DarTaskFactory.CreateTaskAggregate(this.TaskType); this.UpdateDarTaskAggregate(darTaskAggregate); return(darTaskAggregate); }
public void UpdateDarTaskAggregate(DarTaskAggregate taskAggregate) { taskAggregate.Id = this.Id; taskAggregate.Enabled = this.Enabled; taskAggregate.TaskType = this.TaskType; taskAggregate.ScopeId = Convert.ToBase64String(this.ScopeId); taskAggregate.MaxRunningTasks = this.MaxRunningTasks; taskAggregate.RecurrenceType = this.RecurrenceType; taskAggregate.RecurrenceFrequency = this.RecurrenceFrequency; taskAggregate.RecurrenceInterval = this.RecurrenceInterval; taskAggregate.WorkloadContext = this; }
public void UpdateFromDarTaskAggregate(DarTaskAggregate taskAggregate) { if (taskAggregate == null) { throw new ArgumentNullException("task"); } if (taskAggregate.WorkloadContext != null && taskAggregate.WorkloadContext != this) { throw new InvalidOperationException("Task is bound to another raw object use it to perform udpate"); } this.Id = Helper.ToDefaultString(taskAggregate.Id, null); this.Enabled = taskAggregate.Enabled; this.TaskType = Helper.ToDefaultString(taskAggregate.TaskType, null); this.ScopeId = Convert.FromBase64String(taskAggregate.ScopeId); this.MaxRunningTasks = taskAggregate.MaxRunningTasks; this.RecurrenceType = taskAggregate.RecurrenceType; this.RecurrenceFrequency = taskAggregate.RecurrenceFrequency; this.RecurrenceInterval = taskAggregate.RecurrenceInterval; taskAggregate.WorkloadContext = this; }