Show / Hide Table of Contents

# Class Message

Provides common details for protocol messages of any format.

##### Inheritance

System.Object
Message

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public class Message

### Properties

| Improve this Doc View Source

#### Contents

Gets or sets a JToken containing the contents of the message.

##### Declaration

    public JToken Contents { get; set; }

##### Property Value

Type | Description
--- | ---
Newtonsoft.Json.Linq.JToken |

| Improve this Doc View Source

#### Error

Gets or sets a JToken containing error details.

##### Declaration

    public JToken Error { get; set; }

##### Property Value

Type | Description
--- | ---
Newtonsoft.Json.Linq.JToken |

| Improve this Doc View Source

#### Id

Gets or sets the message's sequence ID.

##### Declaration

    public string Id { get; set; }

##### Property Value

Type | Description
--- | ---
System.String |

| Improve this Doc View Source

#### MessageType

Gets or sets the message type.

##### Declaration

    public MessageType MessageType { get; set; }

##### Property Value

Type | Description
--- | ---
MessageType |

| Improve this Doc View Source

#### Method

Gets or sets the message's method/command name.

##### Declaration

    public string Method { get; set; }

##### Property Value

Type | Description
--- | ---
System.String |

### Methods

| Improve this Doc View Source

#### Event(String, JToken)

Creates a message with an Event type.

##### Declaration

    public static Message Event(string method, JToken contents)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | method | The method name of the event.
Newtonsoft.Json.Linq.JToken | contents | The contents of the event.

##### Returns

Type | Description
--- | ---
Message | A message with an Event type.

| Improve this Doc View Source

#### Request(String, String, JToken)

Creates a message with a Request type.

##### Declaration

    public static Message Request(string id, string method, JToken contents)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id | The sequence ID of the request.
System.String | method | The method name of the request.
Newtonsoft.Json.Linq.JToken | contents | The contents of the request.

##### Returns

Type | Description
--- | ---
Message | A message with a Request type.

| Improve this Doc View Source

#### Response(String, String, JToken)

Creates a message with a Response type.

##### Declaration

    public static Message Response(string id, string method, JToken contents)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id | The sequence ID of the original request.
System.String | method | The method name of the original request.
Newtonsoft.Json.Linq.JToken | contents | The contents of the response.

##### Returns

Type | Description
--- | ---
Message | A message with a Response type.

| Improve this Doc View Source

#### ResponseError(String, String, JToken)

Creates a message with a Response type and error details.

##### Declaration

    public static Message ResponseError(string id, string method, JToken error)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id | The sequence ID of the original request.
System.String | method | The method name of the original request.
Newtonsoft.Json.Linq.JToken | error | The error details of the response.

##### Returns

Type | Description
--- | ---
Message | A message with a Response type and error details.

| Improve this Doc View Source

#### Unknown()

Creates a message with an Unknown type.

##### Declaration

    public static Message Unknown()

##### Returns

Type | Description
--- | ---
Message | A message with Unknown type.