Class ConnectionExtensions
Extension methods related to IConnection.
Inheritance
Inherited Members
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public static class ConnectionExtensions
Methods
| Improve this Doc View SourceApply(IConnection, Command, Object[])
Get the result of executing the specified AML query
Declaration
public static IReadOnlyResult Apply(this IConnection conn, Command query, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Connection to execute the query on |
Command | query | Query to be performed. If parameters are specified, they will be substituted into the query |
System.Object[] | parameters | Parameters to be injected into the query |
Returns
Type | Description |
---|---|
IReadOnlyResult | A read-only result |
Examples
// Get preliminary parts which have existed for a little bit of time
var components = conn.Apply(@"-
@0
@1
Preliminary
", classification, DateTime.Now.AddMinutes(-20)).Items();
|
Improve this Doc
View Source
ApplyAsync(IAsyncConnection, Command, Boolean, Boolean, Object[])
Get the result of executing the specified AML query
Declaration
public static IPromise<IReadOnlyResult> ApplyAsync(this IAsyncConnection conn, Command query, bool async, bool noItemsIsError, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
IAsyncConnection | conn | Connection to execute the query on |
Command | query | Query to be performed. If parameters are specified, they will be substituted into the query |
System.Boolean | async | Whether to perform the query asynchronously |
System.Boolean | noItemsIsError | Whether a 'No items found' exception should be signaled to the IPromise as an exception |
System.Object[] | parameters | Parameters to be injected into the query |
Returns
Type | Description |
---|---|
IPromise<IReadOnlyResult> | A read-only result |
ApplyAsync(IAsyncConnection, Command, CancellationToken, Object[])
Get the result of executing the specified AML query
Declaration
public static IPromise<IReadOnlyResult> ApplyAsync(this IAsyncConnection conn, Command query, CancellationToken ct, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
IAsyncConnection | conn | Connection to execute the query on |
Command | query | Query to be performed. If parameters are specified, they will be substituted into the query |
System.Threading.CancellationToken | ct | A System.Threading.CancellationToken used to cancel the asynchronous operation |
System.Object[] | parameters | Parameters to be injected into the query |
Returns
Type | Description |
---|---|
IPromise<IReadOnlyResult> | A read-only result |
ApplySql(IAsyncConnection, Command, Boolean)
Get the result of executing the specified SQL query
Declaration
public static IPromise<IReadOnlyResult> ApplySql(this IAsyncConnection conn, Command sql, bool async)
Parameters
Type | Name | Description |
---|---|---|
IAsyncConnection | conn | Connection to execute the query on |
Command | sql | SQL query to be performed. If parameters are specified, they will be substituted into the query |
System.Boolean | async | Whether to perform the query asynchronously |
Returns
Type | Description |
---|---|
IPromise<IReadOnlyResult> | A read-only result |
ApplySql(IAsyncConnection, Command, CancellationToken)
Get the result of executing the specified SQL query
Declaration
public static IPromise<IReadOnlyResult> ApplySql(this IAsyncConnection conn, Command sql, CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
IAsyncConnection | conn | Connection to execute the query on |
Command | sql | SQL query to be performed. If parameters are specified, they will be substituted into the query |
System.Threading.CancellationToken | ct | A System.Threading.CancellationToken used to cancel the asynchronous operation |
Returns
Type | Description |
---|---|
IPromise<IReadOnlyResult> | A read-only result |
ApplySql(IConnection, Command, Object[])
Get the result of executing the specified SQL query
Declaration
public static IReadOnlyResult ApplySql(this IConnection conn, Command sql, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Connection to execute the query on |
Command | sql | SQL query to be performed. If parameters are specified, they will be substituted into the query |
System.Object[] | parameters | Parameters to be injected into the query |
Returns
Type | Description |
---|---|
IReadOnlyResult | A read-only result |
ItemById(IConnection, String, String)
Retrieve an item based on its type and ID
Declaration
public static IReadOnlyItem ItemById(this IConnection conn, string itemTypeName, string id)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Connection to query the item on |
System.String | itemTypeName | Name of the item type |
System.String | id | ID of the item |
Returns
Type | Description |
---|---|
IReadOnlyItem |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
ItemById<T>(IConnection, String, String, Func<IReadOnlyItem, T>)
Retrieve an item based on its type and ID and map it to an object
Declaration
public static T ItemById<T>(this IConnection conn, string itemTypeName, string id, Func<IReadOnlyItem, T> mapper)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Connection to query the item on |
System.String | itemTypeName | Name of the item type |
System.String | id | ID of the item |
System.Func<IReadOnlyItem, T> | mapper | Mapping function used to get an object from the item data |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
ItemByKeyedName(IConnection, String, String)
Retrieve an item based on its type and keyed name
Declaration
public static IReadOnlyItem ItemByKeyedName(this IConnection conn, string itemTypeName, string keyedName)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Connection to query the item on |
System.String | itemTypeName | Name of the item type |
System.String | keyedName | Keyed name of the item |
Returns
Type | Description |
---|---|
IReadOnlyItem |
ItemByQuery(IConnection, Command)
Get a single item from the database using the specified query. If the result is not a single item, an exception will be thrown
Declaration
public static IReadOnlyItem ItemByQuery(this IConnection conn, Command request)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Server connection |
Command | request | Query/command which should return a single item |
Returns
Type | Description |
---|---|
IReadOnlyItem | A single readonly item |
ItemByQuery(IConnection, Command, Boolean)
Get a single item from the database using the specified query asynchronously. If the result is not a single item, an exception will be thrown
Declaration
public static IPromise<IReadOnlyItem> ItemByQuery(this IConnection conn, Command request, bool async)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | Server connection |
Command | request | Query/command which should return a single item |
System.Boolean | async | Whether to perform this request asynchronously |
Returns
Type | Description |
---|---|
IPromise<IReadOnlyItem> | A promise to return a single readonly item |
Lock(IConnection, String, String)
Locks the specified item.
Declaration
public static IReadOnlyItem Lock(this IConnection conn, string itemTypeName, string id)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | The connection. |
System.String | itemTypeName | Name of the item type. |
System.String | id | The ID. |
Returns
Type | Description |
---|---|
IReadOnlyItem | The resulting item |
NextSequence(IConnection, String)
Returns the next number in the sequence.
Declaration
public static string NextSequence(this IConnection conn, string sequenceName)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | The connection. |
System.String | sequenceName | Name of the sequence. |
Returns
Type | Description |
---|---|
System.String | The next number in the sequence. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Sequence name must be specified - sequenceName |
Promote(IConnection, String, String, String, String)
Promotes the specified item.
Declaration
public static IReadOnlyResult Promote(this IConnection conn, string itemTypeName, string id, string newState, string comments = null)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | The connection. |
System.String | itemTypeName | Name of the item type. |
System.String | id | The Aras ID. |
System.String | newState | The new state. |
System.String | comments | The comments. |
Returns
Type | Description |
---|---|
IReadOnlyResult | The result returned by the server |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | State must be a non-empty string to run a promotion. - newState |
Unlock(IConnection, String, String)
Unlocks the specified item.
Declaration
public static IReadOnlyItem Unlock(this IConnection conn, string itemTypeName, string id)
Parameters
Type | Name | Description |
---|---|---|
IConnection | conn | The connection. |
System.String | itemTypeName | Name of the item type. |
System.String | id | The Aras ID. |
Returns
Type | Description |
---|---|
IReadOnlyItem | The new item data |