This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
eventbrokerregistrationoverinterface.html
57 lines (54 loc) · 1.94 KB
/
eventbrokerregistrationoverinterface.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
layout: documentation
title: EventBroker
teaser: Decoupled eventing with automatic thread switching
navigation:
- name: Overview
link: eventbroker.html
- name: Tutorial
link: eventbrokertutorial.html
- name: Registration by Attribute
link: eventbrokerregistrationbyattribute.html
- name: Registration over Interface
link: eventbrokerregistrationoverinterface.html
- name: Registration by Registrar
link: eventbrokerregistrationbyregistrar.html
- name: Simplified Handler Methods
link: eventbrokersimplifiedhandlermethods.html
- name: Direct Interaction
link: eventbrokerdirectinteraction.html
- name: Handlers
link: eventbrokerhandlers.html
- name: Matchers
link: eventbrokermatchers.html
- name: Exception Handling
link: eventbrokerexceptionhandling.html
- name: Extensions
link: eventbrokerextensions.html
- name: Logging
link: eventbrokerlogging.html
- name: Testability
link: eventbrokertestability.html
- name: Tips and Tricks
link: eventbrokertipsandtricks.html
- name: Specifications
link: eventbrokerspecifications.html
---
<h2>Registration over Interface</h2>
<p>
If you have multiple implementations of an interface (for example a plug-in), you can define on the interface itself, which events or event handler methods should by used.
This allows you to define the interaction with the event broker once on the interface for all implementations.
</p>
<script type="syntaxhighlighter" class="brush: csharp"><![CDATA[
public interface MyInterface
{
[EventPublication("topic://Publish")]
event EventHandler Event;
[EventSubscription("topic://Subscribe", typeof(OnPublisher))]
void Handle(object sender, EventArgs eventArgs);
}
]]></script>
<p>
The class implementing the interface mustn't repeat the attributes or register the event or event handler method over the registrar.
This would result in an exception during registration.
</p>