public ISet <string> FindSagas(Type sagaType, AssociationValue associationValue) { return(_managedSagas.Where(avEntry => sagaType.IsInstanceOfType(avEntry.Value.Saga)) .Where(avEntry => avEntry.Value.AssociationValues.Contains(associationValue)) .Select(x => x.Key) .ToHashSet()); }
public override ISet <string> Find(AssociationValue associationValue) { var sagasFound = new SortedSet <string>(); _managedSagas.Values.Where(saga => saga.AssociationValues.Contains(associationValue)) .Select(x => x.SagaIdentifier) .ForEach(x => sagasFound.Add(x)); _sagaStore.FindSagas(typeof(T), associationValue).ForEach(x => sagasFound.Add(x)); return(sagasFound); }
public ISet <string> FindSagas(Type sagaType, AssociationValue associationValue) { try { using (var conn = _connectionProvider()) { return(_sqldef.SqlFindAssocSagaIdentifiers(conn, associationValue.PropertyKey, associationValue.PropertyValue, SagaTypeName(sagaType))); } } catch (DataException e) { throw new SagaStorageException("Exception while loading a Saga", e); } }
// Add Association Value. public int AddAssociationValue(int associationId, string value) { var asValueContent = _context.AssociationValueContent.FirstOrDefault(x => x.Value == value); if (asValueContent == null) { asValueContent = new AssociationValueContent() { Value = value }; _context.AssociationValueContent.Add(asValueContent); _context.SaveChanges(); } AssociationValue associationValue = new AssociationValue() { AssociationId = associationId, AssociationValueContentId = asValueContent.Id }; _context.AssociationValue.Add(associationValue); _context.SaveChanges(); return(associationValue.Id); }
public abstract ISet <string> Find(AssociationValue associationValue);
public SagaInitializationPolicy(SagaCreationPolicy creationPolicy, AssociationValue initialAssociationValue) { CreationPolicy = creationPolicy; InitialAssociationValue = initialAssociationValue; }