public ConventionBasedCommitProjecter(ProjectorBase projector, IDbService dbService, ConventionBasedEventDispatcher dispatcher) { _projector = projector; _dbService = dbService; _dispatcher = dispatcher; _rnd = new Random(); }
private static object GetProjectorParams(ProjectorBase projector) { return(new { ProjectorId = projector.ProjectorId, ProjectorName = projector.GetType().Name, LastCheckpointToken = projector.Checkpoint.Get() }); }
/// <summary> /// Persists the projector's current checkpoint in the db (in scope of tx) /// </summary> /// <param name="projector"></param> /// <param name="tx"></param> public static void PersistProjectorCheckpoint(this ProjectorBase projector, IDbTransaction tx) { var sqlParams = GetProjectorParams(projector); tx.Connection.Execute(SqlPersistProjectorState, sqlParams, tx); }
/// <summary> /// Gets the uniqueprojectorId of a projector /// </summary> /// <param name="projector"></param> /// <exception cref="ArgumentException">Thrown if the attribute is mssing</exception> /// <returns></returns> public static int GetProjectorId(this ProjectorBase projector) { return(GetProjectorId(projector.GetType())); }
/// <summary> /// Persists the projector's current checkpoint in the db (no tx) /// </summary> /// <param name="projector"></param> /// <param name="conn"></param> public static void PersistProjectorCheckpoint(this ProjectorBase projector, IDbConnection conn) { var sqlParams = GetProjectorParams(projector); conn.Execute(SqlPersistProjectorState, sqlParams); }