DataSource.NET
6.2.20.310828
|
An INamespace is used to determine if a subject is of interest to an Caplin.DataSource.Publisher.IDataProvider. More...
Public Member Functions | |
bool | Match (string subject) |
Tests an string to see if it falls within this INamespace. More... | |
An INamespace is used to determine if a subject is of interest to an Caplin.DataSource.Publisher.IDataProvider.
A subject name is defined within a DataSource namespace. For example, if the DataSource namespace is the prefix "/FX" the subject name "/FX/EURUSD" is within that namespace, but "/FY/EURUSD" is not. INamespace is the interface that represents a DataSource namespace.
An INamespace is used to construct an Caplin.DataSource.Publisher.IPublisher and to ensure that the associated Caplin.DataSource.Publisher.IDataProvider only receives requests for subjects that it can supply.
DataSource.NET includes the following implementations of INameSpace:
In particular, the Caplin.DataSource.Namespace.RegexNamespace provides a flexible way to match subjects against inclusion and exclusion patterns, so you should not normally need to use INamespace directly. However, should the supplied DataSource namespace implementations not match your requirements you can write your own custom subject matching logic in an implementation of INamespace.
The following example provides a simple prefix matching INamespace implementation
bool Caplin.DataSource.Namespace.INamespace.Match | ( | string | subject | ) |
Tests an string to see if it falls within this INamespace.
subject | The string to be tested for matching |
An example of a simple prefix based INamespace implementation is below. Note the ToString() method is used to to obtain the full string-version of the string.
Implemented in Caplin.DataSource.Namespace.RegexNamespace, and Caplin.DataSource.Namespace.PrefixNamespace.