• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITransactionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITransactionContext的典型用法代码示例。如果您正苦于以下问题:C# ITransactionContext类的具体用法?C# ITransactionContext怎么用?C# ITransactionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITransactionContext类属于命名空间,在下文中一共展示了ITransactionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TransactionPropertyNode

 /// <summary>
 /// Constructor</summary>
 public TransactionPropertyNode(ITransactionContext context)
 {
     if(context != null)
         m_contextRef = new WeakReference(context);
     else
         IsReadOnly = true;
 }
开发者ID:Joxx0r,项目名称:ATF,代码行数:9,代码来源:TransactionPropertyNode.cs


示例2: TransactedTask

 public TransactedTask(ITask inner, ITransactionContext transactionContext)
 {
     if (inner == null) throw new ArgumentNullException("inner");
     if (transactionContext == null) throw new ArgumentNullException("transactionContext");
     _inner = inner;
     _transactionContext = transactionContext;
 }
开发者ID:Readify,项目名称:IocDevDay,代码行数:7,代码来源:TransactedTask.cs


示例3: TransactedActionFilter

 public TransactedActionFilter(ITransactionContext transactionContext, EventDispatchHandler dispatchHandler, ILocalEventsManager domainEvents)
 {
     if (transactionContext == null) throw new ArgumentNullException("transactionContext");
     _transactionContext = transactionContext;
     _dispatchHandler = dispatchHandler;
     _domainEvents = domainEvents;
 }
开发者ID:brendankowitz,项目名称:Samples,代码行数:7,代码来源:TransactedActionFilter.cs


示例4: DbLogger

        public DbLogger(ITransactionContext context)
        {
            this.context = context;

            Error = new DbLoggerError(this);
            Info = new DbLoggerInfo(this);
        }
开发者ID:JohannesHoppe,项目名称:FinTsPersistence,代码行数:7,代码来源:DbLogger.cs


示例5: HandleMessage

        public void HandleMessage(TransportMessage transportMessage, ITransactionContext transactionContext)
        {
            var message = transportMessage.GetMessageLabel();

            var options = new List<KeyOption>();

            if (DefaultOutputQueue != null)
            {
                options.Add(KeyOption.New('d',
                    () => { MoveMessage(transportMessage, transactionContext, DefaultOutputQueue); },
                    "Move to default queue '{0}'", DefaultOutputQueue));
            }

            if (transportMessage.Headers.ContainsKey(Headers.SourceQueue))
            {
                var sourceQueue = transportMessage.Headers[Headers.SourceQueue];

                options.Add(KeyOption.New('s',
                    () => { MoveMessage(transportMessage, transactionContext, sourceQueue); },
                    "Return to source queue '{0}'", sourceQueue));
            }

            options.Add(KeyOption.New('c', () =>
            {
                Console.Write("queue > ");
                var queueName = Console.ReadLine();
                MoveMessage(transportMessage, transactionContext, queueName);
            }, "Enter custom queue name to move message to"));

            Prompt(message, options);

            Text.PrintLine();
        }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:33,代码来源:ReturnToSourceQueue.cs


示例6: IncomingStepContext

 /// <summary>
 /// Constructs the step context, initially stashing the given <see cref="TransportMessage"/> and <see cref="ITransactionContext"/> into its bag of objects
 /// </summary>
 public IncomingStepContext(TransportMessage message, ITransactionContext transactionContext)
 {
     Save(message);
     Save(transactionContext);
     
     transactionContext.Items[StepContextKey] = this;
 }
开发者ID:RichieYang,项目名称:Rebus,代码行数:10,代码来源:IncomingStepContext.cs


示例7: HandlePoisonMessage

        /// <summary>
        /// Handles the poisonous message by forwarding it to the configured error queue
        /// </summary>
        public async Task HandlePoisonMessage(TransportMessage transportMessage, ITransactionContext transactionContext, string errorDescription)
        {
            var headers = transportMessage.Headers;

            string messageId ;

            if (!headers.TryGetValue(Headers.MessageId, out messageId))
            {
                messageId = "<unknown>";
            }

            headers[Headers.ErrorDetails] = errorDescription;
            headers[Headers.SourceQueue] = _transport.Address;

            var errorQueueAddress = _simpleRetryStrategySettings.ErrorQueueAddress;

            try
            {
                _log.Error("Moving message with ID {0} to error queue '{1}' - reason: {2}", messageId, errorQueueAddress, errorDescription);

                await _transport.Send(errorQueueAddress, transportMessage, transactionContext);
            }
            catch (Exception exception)
            {
                _log.Error(exception, "Could not move message with ID {0} to error queue '{1}' - will pause {2} to avoid thrashing",
                    messageId, errorQueueAddress, MoveToErrorQueueFailedPause);

                // if we can't move to error queue, we need to avoid thrashing over and over
                await Task.Delay(MoveToErrorQueueFailedPause);
            }
        }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:34,代码来源:PoisonQueueErrorHandler.cs


示例8: Send

        public void Send(string destinationQueueName, TransportMessageToSend message, ITransactionContext context)
        {
            var outputQueue = cloudQueueClient.GetQueueReference(destinationQueueName);

            using (var memoryStream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                var receivedTransportMessage = new ReceivedTransportMessage
                    {
                        Id = Guid.NewGuid().ToString(),
                        Headers = message.Headers,
                        Body = message.Body,
                        Label = message.Label,
                    };

                formatter.Serialize(memoryStream, receivedTransportMessage);
                memoryStream.Position = 0;

                var cloudQueueMessage = new CloudQueueMessage(memoryStream.ToArray());

                var timeToLive = GetTimeToLive(message);
                if (timeToLive.HasValue)
                {
                    outputQueue.AddMessage(cloudQueueMessage, timeToLive.Value);
                }
                else
                {
                    outputQueue.AddMessage(cloudQueueMessage);
                }
            }
        }
开发者ID:nls75,项目名称:Rebus,代码行数:31,代码来源:AzureMessageQueue.cs


示例9: ReceiveMessage

        public ReceivedTransportMessage ReceiveMessage(ITransactionContext context)
        {
            var receivedTransportMessage = innerReceiveMessages.ReceiveMessage(context);

            if (receivedTransportMessage == null) return null;

            byte[] body;
            var headers = receivedTransportMessage.Headers.Clone();

            if (headers.ContainsKey(Headers.Encrypted))
            {
                var iv = receivedTransportMessage.GetHeader(Headers.EncryptionSalt);
                body = helper.Decrypt(receivedTransportMessage.Body, iv);

                headers.Remove(Headers.EncryptionSalt);
                headers.Remove(Headers.Encrypted);
            }
            else
            {
                body = receivedTransportMessage.Body;
            }

            return new ReceivedTransportMessage
                       {
                           Id = receivedTransportMessage.Id,
                           Headers = headers,
                           Label = receivedTransportMessage.Label,
                           Body = body,
                       };
        }
开发者ID:rasmuskl,项目名称:Rebus,代码行数:30,代码来源:RijndaelEncryptionTransportDecorator.cs


示例10: Send

        /// <summary>
        /// Sends the given <see cref="TransportMessage"/> to the queue with the specified globally addressable name
        /// </summary>
        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            context.OnCommitted(async () =>
            {
                var headers = message.Headers.Clone();
                var queue = GetQueue(destinationAddress);
                var messageId = Guid.NewGuid().ToString();
                var popReceipt = Guid.NewGuid().ToString();
                var timeToBeReceivedOrNull = GetTimeToBeReceivedOrNull(headers);
                var queueVisibilityDelayOrNull = GetQueueVisibilityDelayOrNull(headers);
                var cloudQueueMessage = Serialize(messageId, popReceipt, headers, message.Body);

                try
                {
                    var options = new QueueRequestOptions {RetryPolicy = new ExponentialRetry()};
                    var operationContext = new OperationContext();

                    await queue.AddMessageAsync(cloudQueueMessage, timeToBeReceivedOrNull, queueVisibilityDelayOrNull, options, operationContext);
                }
                catch (Exception exception)
                {
                    throw new RebusApplicationException(exception, $"Could not send message with ID {cloudQueueMessage.Id} to '{destinationAddress}'");
                }
            });
        }
开发者ID:RichieYang,项目名称:Rebus,代码行数:28,代码来源:AzureStorageQueuesTransport.cs


示例11: DeleteOrderCommand

 public DeleteOrderCommand(long orderID, IOrderDataProxy orderDataProxy, OrderItemService orderItemService, ITransactionContext transactionContext)
 {
     _orderID = orderID;
     _orderDataProxy = orderDataProxy;
     _orderItemService = orderItemService;
     _transactionContext = transactionContext;
 }
开发者ID:ndphuong,项目名称:Peasy.NET,代码行数:7,代码来源:DeleteOrderCommand.cs


示例12: Send

        /// <summary>
        /// Sends a copy of the specified <see cref="TransportMessageToSend"/> using the underlying implementation of <see cref="ISendMessages"/>
        /// with an encrypted message body and additional headers
        /// </summary>
        public void Send(string destinationQueueName, TransportMessageToSend message, ITransactionContext context)
        {
            var clone = new TransportMessageToSend
                            {
                                Headers = message.Headers.Clone(),
                                Label = message.Label,
                                Body = message.Body,
                            };

            if (compressionHelper != null)
            {
                var compresssionResult = compressionHelper.Compress(clone.Body);
                if (compresssionResult.Item1)
                {
                    clone.Headers[Headers.Compression] = Headers.CompressionTypes.GZip;
                }
                clone.Body = compresssionResult.Item2;
            }

            if (encryptionHelper != null)
            {
                var iv = encryptionHelper.GenerateNewIv();
                clone.Body = encryptionHelper.Encrypt(clone.Body, iv);
                clone.Headers[Headers.Encrypted] = null;
                clone.Headers[Headers.EncryptionSalt] = iv;
            }

            innerSendMessages.Send(destinationQueueName, clone, context);
        }
开发者ID:JanRou,项目名称:Rebus,代码行数:33,代码来源:EncryptionAndCompressionTransportDecorator.cs


示例13: Transaction

        internal Transaction(ITransactionContext context, Database database, int commitId, IsolationLevel isolation, IEnumerable<TableSource> committedTables, IEnumerable<IIndexSet> indexSets)
        {
            CommitId = commitId;
            Database = database;
            Isolation = isolation;
            Context = context;

            context.RegisterInstance<ITransaction>(this);

            Registry = new TransactionRegistry(this);
            TableManager.AddVisibleTables(committedTables, indexSets);

            AddInternalTables();

            TableState = new OldNewTableState();

            IsClosed = false;

            Database.TransactionFactory.OpenTransactions.AddTransaction(this);

            this.CurrentSchema(database.Context.DefaultSchema());
            this.ReadOnly(database.Context.ReadOnly());
            this.AutoCommit(database.Context.AutoCommit());
            this.IgnoreIdentifiersCase(database.Context.IgnoreIdentifiersCase());
            this.ParameterStyle(QueryParameterStyle.Marker);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:26,代码来源:Transaction.cs


示例14: OrderItemClientService

 public OrderItemClientService(IOrderItemDataProxy dataProxy,
                               IProductDataProxy productDataProxy,
                               IInventoryItemDataProxy inventoryDataProxy,
                               ITransactionContext transactionContext) : base(dataProxy, productDataProxy, inventoryDataProxy, transactionContext)
 {
     _inventoryDataProxy = inventoryDataProxy;
     _transactionContext = transactionContext;
 }
开发者ID:peasy,项目名称:Samples,代码行数:8,代码来源:OrderItemClientService.cs


示例15: Send

        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            await _innerTransport.Send(destinationAddress, message, context);

            _sentMessages.Add(message);

            MessageSent(message);
        }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:8,代码来源:TransportTap.cs


示例16: Receive

        public async Task<TransportMessage> Receive(ITransactionContext context, CancellationToken cancellationToken)
        {
            if (_receiveLatencyMs.HasValue)
            {
                await Task.Delay(_receiveLatencyMs.Value, cancellationToken);
            }

            return await _innerTransport.Receive(context, cancellationToken);
        }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:9,代码来源:In.cs


示例17: Send

        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            if (_sendLatencyMs.HasValue)
            {
                await Task.Delay(_sendLatencyMs.Value);
            }

            await _innerTransport.Send(destinationAddress, message, context);
        }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:9,代码来源:In.cs


示例18: Set

 /// <summary>
 /// Assigns the specified <see cref="ITransactionContext"/> to the current context
 /// </summary>
 public static void Set(ITransactionContext context)
 {
     if (RebusHttpContext.InContext)
         RebusHttpContext.TransactionContext = context;
     else if (RebusOperationContext.InContext)
         RebusOperationContext.TransactionContext = context;
     else
         CallContext.LogicalSetData(TransactionContextKey, context);
 }
开发者ID:nls75,项目名称:Rebus,代码行数:12,代码来源:TransactionContext.cs


示例19: PropertyEditorControlContext

 /// <summary>
 /// Constructor</summary>
 /// <param name="editingControlOwner">Interface for property editing control owners</param>
 /// <param name="descriptor">Property descriptor</param>
 /// <param name="transactionContext">Interface for transaction contexts</param>
 /// <param name="contextRegistry">Context registry</param>
 public PropertyEditorControlContext(
     IPropertyEditingControlOwner editingControlOwner,
     PropertyDescriptor descriptor,
     ITransactionContext transactionContext,
     IContextRegistry contextRegistry)
     : this(editingControlOwner, descriptor, transactionContext)
 {
     m_contextRegistry = contextRegistry;
 }
开发者ID:sbambach,项目名称:ATF,代码行数:15,代码来源:PropertyEditorControlContext.cs


示例20: Set

 /// <summary>
 /// Initializes this dialog with the required and optional contexts</summary>
 /// <param name="selectionContext">Selection context -- required</param>
 /// <param name="namingContext">Naming context -- required</param>
 /// <param name="transactionContext">Transaction context -- optional</param>
 /// <remarks>Combine with the constructor? This separate Set() only makes sense if this dialog box
 /// is floating or dockable.</remarks>
 public void Set(
     ISelectionContext selectionContext,
     INamingContext namingContext,
     ITransactionContext transactionContext)
 {
     m_selectionContext = selectionContext;
     m_namingContext = namingContext;
     m_transactionContext = transactionContext;
     UpdatePreview();
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:17,代码来源:RenameCommandDialog.cs



注:本文中的ITransactionContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITransactionManager类代码示例发布时间:2022-05-24
下一篇:
C# ITransaction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap