当前位置: 首页>>代码示例>>C#>>正文


C# Conventions.IsEventType方法代码示例

本文整理汇总了C#中Conventions.IsEventType方法的典型用法代码示例。如果您正苦于以下问题:C# Conventions.IsEventType方法的具体用法?C# Conventions.IsEventType怎么用?C# Conventions.IsEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Conventions的用法示例。


在下文中一共展示了Conventions.IsEventType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssertIsValidForSend

 public static void AssertIsValidForSend(Type messageType, Conventions conventions)
 {
     if (conventions.IsEventType(messageType))
     {
         throw new InvalidOperationException("Events can have multiple recipient so they should be published");
     }
 }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:7,代码来源:MessagingBestPractices.cs

示例2: AssertIsValidForReply

 public static void AssertIsValidForReply(Type messageType, Conventions conventions)
 {
     if (conventions.IsCommandType(messageType) || conventions.IsEventType(messageType))
     {
         throw new InvalidOperationException("Reply is neither supported for Commands nor Events. Commands should be sent to their logical owner using bus.Send and bus. Events should be Published with bus.Publish.");
     }
 }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:7,代码来源:MessagingBestPractices.cs

示例3: Should_cache_the_message_convention

        public void Should_cache_the_message_convention()
        {
            var timesCalled = 0;
            conventions = new Conventions
            {
                IsEventTypeAction = t =>
                {
                    timesCalled++;
                    return false;
                }
            };

            conventions.IsEventType(GetType());
            Assert.AreEqual(1, timesCalled);

            conventions.IsEventType(GetType());
            Assert.AreEqual(1, timesCalled);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:18,代码来源:MessageConventionSpecs.cs

示例4: AssertIsValidForPubSub

        public static void AssertIsValidForPubSub(Type messageType, Conventions conventions)
        {
            if (conventions.IsCommandType(messageType))
            {
                throw new InvalidOperationException("Pub/Sub is not supported for Commands. They should be be sent direct to their logical owner.");
            }

            if (!conventions.IsEventType(messageType))
            {
                Log.Info("You are using a basic message to do pub/sub, consider implementing the more specific ICommand and IEvent interfaces to help NServiceBus to enforce messaging best practices for you.");
            }
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:12,代码来源:MessagingBestPractices.cs

示例5: IsEventType_should_return_false_for_NServiceBus_types

 public void IsEventType_should_return_false_for_NServiceBus_types()
 {
     var conventions = new Conventions
     {
         IsEventTypeAction = t => t.Assembly == typeof(Conventions).Assembly
     };
     Assert.IsFalse(conventions.IsEventType(typeof(Conventions)));
 }
开发者ID:Particular,项目名称:NServiceBus,代码行数:8,代码来源:ConventionsTests.cs

示例6: IsEventType_should_return_true_for_matching_type

 public void IsEventType_should_return_true_for_matching_type()
 {
     var conventions = new Conventions
     {
         IsEventTypeAction = t => t.Assembly == typeof(Conventions).Assembly ||
                                    t == typeof(MyConventionEvent)
     };
     Assert.IsTrue(conventions.IsEventType(typeof(MyConventionEvent)));
 }
开发者ID:Particular,项目名称:NServiceBus,代码行数:9,代码来源:ConventionsTests.cs


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