DataSource.NET
INamespace Interface
NamespacesCaplin.DataSource.NamespaceINamespace
An INamespace is used to determine if a subject is of interest to an IDataProvider.
Declaration Syntax
C#Visual BasicVisual C++
public interface INamespace
Public Interface INamespace
public interface class INamespace
Members
All MembersMethods



IconMemberDescription
Match(String)
Tests an String to see if it falls within this INamespace.

Remarks

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 IPublisher and to ensure that the associated IDataProvider only receives requests for subjects that it can supply.

DataSource.NET includes the following implementations of INameSpace:

In particular, the 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.

Examples

The following example provides a simple prefix matching INamespace implementation

CopyC#
using Caplin.DataSource;
using Caplin.DataSource.Namespace;

namespace DataSourceExamples.Namespace
{
    class PrefixNamespaceExample : INamespace
    {
        string prefix;

        public PrefixNamespaceExample(string prefix)
        {
            this.prefix = prefix;
        }


        #region INamespace Members

        public bool Match(string subject)
        {
            return subject.ToString().StartsWith(prefix);
        }

        #endregion
    }
}

Assembly: DataSource.NET (Module: DataSource.NET) Version: 6.2.6.2123 (6.2.6.2123)