Skip to main content

AElf.CSharp.Core

Builder type​

Namespace: AElf.CSharp.Core.ServerServiceDefinition

Builder class for ServerServiceDefinition.

ctor() constructor​

Creates a new instance of builder.

AddMethod``2(method, handler) method​

Adds a definition for a single request - single response method.

Returns:​

This builder instance.

Parameters:​

NameTypeDescription
methodAElf.CSharp.Core.MethodThe method.
handlerAElf.CSharp.Core.UnaryServerMethodThe method handler.

Build() method​

Creates an immutable ServerServiceDefinition from this builder.

Returns​

The ServerServiceDefinition object.

EncodingHelper type​

Namespace: AElf.CSharp.Core.Utils

Helper class for serializing strings.

EncodeUtf8(str) method​

Serializes a UTF-8 string to a byte array.

Returns​

The serialized string.

Parameters​

NameTypeDescription
strSystem.StringThe string to encode.

IMethod type​

Namespace: AElf.CSharp.Core

A non-generic representation of a remote method.

FullName property​

Gets the fully qualified name of the method. On the server side, methods are dispatched based on this name.

Name property​

Gets the unqualified name of the method.

ServiceName property​

Gets the name of the service to which this method belongs.

Type property​

Gets the type of the method.

Marshaller type​

Namespace: AElf.CSharp.Core

Encapsulates the logic for serializing and deserializing messages.

ctor(serializer, deserializer) constructor​

Initializes a new marshaller from simple serialize/deserialize functions.

Parameters​

NameTypeDescription
serializerSystem.FuncFunction for serializing messages.
deserializerSystem.FuncFunction for deserializing messages.

Deserializer property​

Gets the deserializer function.

Serializer property​

Gets the serializer function.

Marshallers type​

Namespace: AElf.CSharp.Core

Utilities for creating marshallers.

StringMarshaller property​

Returns a marshaller for string type. Useful for testing.

Create() method​

Creates a marshaller from specified serializer and deserializer.

MethodType type​

Namespace: AElf.CSharp.Core

Constants for method types.

Action constants​

Indicates the method modifies the contract state.

View constants​

Indicates the method doesn't modify the contract state.

Method type​

Namespace: AElf.CSharp.Core

A description of a remote method.

ctor(type, serviceName, name, requestMarshaller, responseMarshaller) constructor​

Initializes a new instance of the Method class.

Parameters​

NameTypeDescription
typeAElf.CSharp.Core.MethodType of method.
serviceNameSystem.StringName of service this method belongs to.
nameSystem.StringUnqualified name of the method.
requestMarshallerAElf.CSharp.Core.MarshallerMarshaller used for request messages.
responseMarshallerAElf.CSharp.Core.MarshallerMarshaller used for response messages.

FullName property​

Gets the fully qualified name of the method. On the server side, methods are dispatched based on this name.

Name property​

Gets the unqualified name of the method.

RequestMarshaller property​

Gets the marshaller used for request messages.

ResponseMarshaller property​

Gets the marshaller used for response messages.

ServiceName property​

Gets the name of the service to which this method belongs.

Type property​

Gets the type of the method.

GetFullName() method​

Gets the full name of the method including the service name.

Preconditions type​

Namespace: AElf.CSharp.Core.Utils

Utilities for checking preconditions.

CheckNotNull(reference) method​

Throws ArgumentNullException if reference is null.

Parameters​

NameTypeDescription
referenceAnyThe reference.

CheckNotNull(reference, paramName) method​

Throws ArgumentNullException if reference is null.

Parameters​

NameTypeDescription
referenceAnyThe reference.
paramNameSystem.StringThe parameter name.

SafeMath type​

Namespace: AElf.CSharp.Core

Helper methods for safe math operations that explicitly check for overflow.

ServerServiceDefinition type​

Namespace: AElf.CSharp.Core

Stores mapping of methods to server call handlers. Normally, created by the BindService factory method.

BindService() method​

Forwards all the previously stored AddMethod calls to the service binder.

CreateBuilder() method​

Creates a new builder object for ServerServiceDefinition.

Returns​

The builder object.

ServiceBinderBase type​

Namespace: AElf.CSharp.Core

Allows binding server-side method implementations in alternative serving stacks.

AddMethod(method, handler) method​

Adds a definition for a single request - single response method.

Parameters​

NameTypeDescription
methodAElf.CSharp.Core.MethodThe method.
handlerAElf.CSharp.Core.UnaryServerMethodThe method handler.

TimestampExtensions type​

Namespace: AElf.CSharp.Core.Extension

Helper methods for dealing with protobuf timestamps.

AddDays(timestamp, days) method​

Adds a given amount of days to a timestamp. Returns a new instance.

Returns​

A new timestamp instance.

Parameters​

NameTypeDescription
timestampGoogle.Protobuf.WellKnownTypes.TimestampThe timestamp.
daysSystem.Int64The amount of days.

AddHours(timestamp, hours) method​

Adds a given amount of hours to a timestamp. Returns a new instance.

Returns​

A new timestamp instance.

Parameters​

NameTypeDescription
timestampGoogle.Protobuf.WellKnownTypes.TimestampThe timestamp.
hoursSystem.Int64The amount of hours.

AddMilliseconds(timestamp, milliseconds) method​

Adds a given amount of milliseconds to a timestamp. Returns a new instance.

Returns​

A new timestamp instance.

Parameters​

NameTypeDescription
timestampGoogle.Protobuf.WellKnownTypes.TimestampThe timestamp.
millisecondsSystem.Int64The amount of milliseconds.

AddMinutes(timestamp, minutes) method​

Adds a given amount of minutes to a timestamp. Returns a new instance.

Returns​

A new timestamp instance.

Parameters​

NameTypeDescription
timestampGoogle.Protobuf.WellKnownTypes.TimestampThe timestamp.
minutesSystem.Int64The amount of minutes.

AddSeconds(timestamp, seconds) method​

Adds a given amount of seconds to a timestamp. Returns a new instance.

Returns​

A new timestamp instance.

Parameters​

NameTypeDescription
timestampGoogle.Protobuf.WellKnownTypes.TimestampThe timestamp.
secondsSystem.Int64The amount of seconds.

Max(timestamp1, timestamp2) method​

Compares two timestamps and returns the greater one.

Returns​

The greater timestamp.

Parameters​

NameTypeDescription
timestamp1Google.Protobuf.WellKnownTypes.TimestampThe first timestamp.
timestamp2Google.Protobuf.WellKnownTypes.TimestampThe second timestamp.

Milliseconds(duration) method​

Converts a protobuf duration to long.

Returns​

The duration represented as a long.

Parameters​

NameTypeDescription
durationGoogle.Protobuf.WellKnownTypes.DurationThe duration to convert.

UnaryServerMethod type​

Namespace: AElf.CSharp.Core

Handler for a contract method.

Generic Types​

NameDescription
TRequestRequest message type for this method
TResponseResponse message type for this method