Esempio n. 1
0
 public DataflowMessageStatus OfferMessage(
     DataflowMessageHeader messageHeader,
     DatabaseInserterMessage <TEntity> messageValue,
     ISourceBlock <DatabaseInserterMessage <TEntity> > source,
     bool consumeToAccept)
 {
     return(((ITargetBlock <DatabaseInserterMessage <TEntity> >)_target)
            .OfferMessage(messageHeader, messageValue, source, consumeToAccept));
 }
Esempio n. 2
0
        private async Task OnReceive(DatabaseInserterMessage <TEntity> message)
        {
            if (message.Entity != null)
            {
                Enqueue(message.Entity);
            }

            if (_idx >= _bufferSize || message.ForceInsert)
            {
                await InsertAll();
            }
        }
Esempio n. 3
0
 private static DatabaseInserterMessage <T> EntityToMessage <T>(T entity)
     where T : class
 {
     return(DatabaseInserterMessage <T> .OfEntity(entity));
 }