public RecalculateStatisticsOperation Deserialize(PerformedOperationFinalProcessing operation) { var context = XElement.Parse(operation.Context); return(new RecalculateStatisticsOperation(new StatisticsKey { ProjectId = (long)context.Attribute("Project"), CategoryId = (long?)context.Attribute("Category"), })); }
public AggregateOperation Deserialize(PerformedOperationFinalProcessing operation) { Type operationType; if (!OperationIdRegistry.TryGetValue(operation.OperationId, out operationType)) { throw new ArgumentException($"Unknown operation id {operation.OperationId}", nameof(operation)); } IEntityType entityName; if (!_registry.TryParse(operation.EntityTypeId, out entityName)) { throw new ArgumentException($"Unknown entity id {operation.EntityTypeId}", nameof(operation)); } return((AggregateOperation)Activator.CreateInstance(operationType, _registry.GetEntityType(entityName), operation.EntityId)); }