www.espertech.comDocumentation

Appendix H. NEsper .NET -Specific Information

This section provides information for NEsper .NET users.

System.Collections.IEnumerable and System.Collections.Generic.IEnumerable<T> are honored in most places where a collection would be taken.

In respect to DateTime differences, the baseline for CLR datetimes is 1/1/0001 12:00:00AM. DateTimes are converted to ticks and then to milliseconds.

Annotations are implemented using .NET attributes. Annotations must derive from System.Attribute and must use .NET attribute naming conventions e.g. @Hint is implemented as HintAttribute.

NEsper provides a lock manager that is configurable once per AppDomain: com.espertech.esper.compat.threading.LockManager is used for lock provision.

com.espertech.esper.compat.threading.ReaderWriterLockManager is used for RW lock management.

com.espertech.esper.compat.threading.ThreadLocalManager is used for thread local management.

com.espertech.esper.util.EsperSectionHandler is provided to read Esper configuration from standard .NET configuration. It must be added as a configSection in order to be used.

For items not handled under the Esper configuration use com.espertech.esper.compat.CompatSettings. These are often applied for the entire AppDomain meaning they are effectively static for the container. These cover the following items:


Event classes provide accessors (getter methods) and mutators (setter methods) by means of auto-implemented properties or read write properties.

Below an example using auto-implemented properties:

class NewEmployeeEvent {
  public string FirstName { get; set; }
  public Address Address { get; set; }	
}

Below an example using read write properties:

class NewEmployeeEvent {
  private string firstName = "N/A";
  private Address address = 0;

  public string FirstName
  {
    get
    {
      return firstName;
    }
    set
    {
      firstName = value;
    }
  }

  public Address Address
  {
    get
    {
      return address;
    }
    set
    {
      address = value;
    }
  }
}

The case conversion is uppercase as dictated by .NET property conventions.

Mapped indexes are handled through the indexing operator.

For .NET the events can be represented by objects that implement the IDictionary interface.

XML events are represented by System.Xml and System.Xml.Linq.

Objects need to follow the .NET property conventions. Objects can follow modified conventions for Java-style accessors and mutators using Get and Set respectively.

UpdateListener is replaced by UpdateEventHandler in .NET. Subscriber objects must implement the Update method or subscriber objects must be a delegate with an appropriate number of arguments.

The data types are sbyte, byte, short, ushort, int, uint, long, ulong, float, double, decimal.

.NET uses ADO-based drivers to accomplish the same work.

NEsper exposes the Events events on EPStatement objects.

The setSubscriber method is replaced with the Subscriber property. This property can take an object or a delegate.

Iterator is replaced with GetEnumerator. SafeIterator is replaced with GetSafeEnumerator.

Listeners are replaced with UpdateEventHandlers, for example countStatement.Events += (sender, args) => { DoWork(); }.

When using internal timer (and not the application provided external time), please note:

Connections are obtained by selecting a DbDriver, which are a NEsper-construct.

Log4j is replaced by .NET Commons Logging.