> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# ApiBase

> Represents a base class for an API.

## Definition

**Assembly:** Microsoft.Restier.Core.dll

**Namespace:** Microsoft.Restier.Core

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
Microsoft.Restier.Core.ApiBase
```

## Summary

Represents a base class for an API.

## Remarks

An API configuration is intended to be long-lived, and can be statically cached according to an API type specified when the
configuration is created. Additionally, the API model produced as a result of a particular configuration is cached under the same
API type to avoid re-computing it on each invocation.

## Constructors

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Properties

### &#x20;ServiceProvider

Gets the [IServiceProvider](https://learn.microsoft.com/dotnet/api/system.iserviceprovider) which contains all services.

#### Syntax

```csharp theme={"dark"}
public System.IServiceProvider ServiceProvider { get; private set; }
```

#### Property Value

Type: `System.IServiceProvider`

## Methods

### &#x20;Dispose

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

#### Syntax

```csharp theme={"dark"}
public void Dispose()
```

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetApiService Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a service instance.

#### Syntax

```csharp theme={"dark"}
public static T GetApiService<T>(Microsoft.Restier.Core.ApiBase api) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |

#### Returns

Type: `T`
The service instance.

#### Type Parameters

* `T` - The service type.

### &#x20;GetApiServices Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

#### Syntax

```csharp theme={"dark"}
public static System.Collections.Generic.IEnumerable<T> GetApiServices<T>(Microsoft.Restier.Core.ApiBase api) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | - |

#### Returns

Type: `System.Collections.Generic.IEnumerable<T>`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetModel Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Retrieves the [IEdmModel](https://learn.microsoft.com/dotnet/api/microsoft.odata.edm.iedmmodel) used by this [ApiBase](https://easyaf.nimbleapps.cloud/restier/api-reference/Microsoft/Restier/Core/ApiBase.md) instance.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.OData.Edm.IEdmModel GetModel(Microsoft.Restier.Core.ApiBase api)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | The [ApiBase](https://easyaf.nimbleapps.cloud/restier/api-reference/Microsoft/Restier/Core/ApiBase.md) instance to extend. |

#### Returns

Type: `Microsoft.OData.Edm.IEdmModel`
The [IEdmModel](https://learn.microsoft.com/dotnet/api/microsoft.odata.edm.iedmmodel) used by this [ApiBase](https://easyaf.nimbleapps.cloud/restier/api-reference/Microsoft/Restier/Core/ApiBase.md) instance.

### &#x20;GetProperty Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a property.

#### Syntax

```csharp theme={"dark"}
public static T GetProperty<T>(Microsoft.Restier.Core.ApiBase api, string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of a property. |

#### Returns

Type: `T`
The value of the property.

#### Type Parameters

* `T` - The type of the property.

### &#x20;GetProperty Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a property.

#### Syntax

```csharp theme={"dark"}
public static object GetProperty(Microsoft.Restier.Core.ApiBase api, string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of a property. |

#### Returns

Type: `object`
The value of the property.

### &#x20;GetQueryableSource Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a queryable source of data using an API context.

#### Syntax

```csharp theme={"dark"}
public static System.Linq.IQueryable GetQueryableSource(Microsoft.Restier.Core.ApiBase api, string name, params object[] arguments)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of an entity set, singleton or composable function import. |
| `arguments` | `object[]` | If *name* is a composable function import, |
| the arguments to be passed to the composable function import. | | |

#### Returns

Type: `System.Linq.IQueryable`
A queryable source.

#### Remarks

If the name identifies a singleton or a composable function import
whose result is a singleton, the resulting queryable source will
be configured such that it represents exactly zero or one result.

Note that the resulting queryable source cannot be synchronously
enumerated as the API engine only operates asynchronously.

### &#x20;GetQueryableSource Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a queryable source of data using an API context.

#### Syntax

```csharp theme={"dark"}
public static System.Linq.IQueryable GetQueryableSource(Microsoft.Restier.Core.ApiBase api, string namespaceName, string name, params object[] arguments)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `namespaceName` | `string` | The name of a namespace containing a composable function. |
| `name` | `string` | The name of a composable function. |
| `arguments` | `object[]` | The arguments to be passed to the composable function. |

#### Returns

Type: `System.Linq.IQueryable`
A queryable source.

#### Remarks

If the name identifies a composable function whose result is a
singleton, the resulting queryable source will be configured such
that it represents exactly zero or one result.

Note that the resulting queryable source cannot be synchronously
enumerated, as the API engine only operates asynchronously.

### &#x20;GetQueryableSource Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a queryable source of data using an API context.

#### Syntax

```csharp theme={"dark"}
public static System.Linq.IQueryable<TElement> GetQueryableSource<TElement>(Microsoft.Restier.Core.ApiBase api, string name, params object[] arguments)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of an entity set, singleton or composable function import. |
| `arguments` | `object[]` | If *name* is a composable function import, |
| the arguments to be passed to the composable function import. | | |

#### Returns

Type: `System.Linq.IQueryable<TElement>`
A queryable source.

#### Type Parameters

* `TElement` - The type of the elements in the queryable source.

#### Remarks

If the name identifies a singleton or a composable function import
whose result is a singleton, the resulting queryable source will
be configured such that it represents exactly zero or one result.

Note that the resulting queryable source cannot be synchronously
enumerated, as the API engine only operates asynchronously.

### &#x20;GetQueryableSource Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Gets a queryable source of data using an API context.

#### Syntax

```csharp theme={"dark"}
public static System.Linq.IQueryable<TElement> GetQueryableSource<TElement>(Microsoft.Restier.Core.ApiBase api, string namespaceName, string name, params object[] arguments)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `namespaceName` | `string` | The name of a namespace containing a composable function. |
| `name` | `string` | The name of a composable function. |
| `arguments` | `object[]` | The arguments to be passed to the composable function. |

#### Returns

Type: `System.Linq.IQueryable<TElement>`
A queryable source.

#### Type Parameters

* `TElement` - The type of the elements in the queryable source.

#### Remarks

If the name identifies a composable function whose result is a
singleton, the resulting queryable source will be configured such
that it represents exactly zero or one result.

Note that the resulting queryable source cannot be synchronously
enumerated, as the API engine only operates asynchronously.

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;HasProperty Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Indicates if this object has a property.

#### Syntax

```csharp theme={"dark"}
public static bool HasProperty(Microsoft.Restier.Core.ApiBase api, string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of a property. |

#### Returns

Type: `bool`
`true` if this object has the property; otherwise, `false`.

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;QueryAsync Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Asynchronously queries for data using an API context.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<Microsoft.Restier.Core.Query.QueryResult> QueryAsync(Microsoft.Restier.Core.ApiBase api, Microsoft.Restier.Core.Query.QueryRequest request, System.Threading.CancellationToken cancellationToken = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `request` | `Microsoft.Restier.Core.Query.QueryRequest` | A query request. |
| `cancellationToken` | `System.Threading.CancellationToken` | An optional cancellation token. |

#### Returns

Type: `System.Threading.Tasks.Task<Microsoft.Restier.Core.Query.QueryResult>`
A task that represents the asynchronous
operation whose result is a query result.

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;RemoveProperty Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Removes a property.

#### Syntax

```csharp theme={"dark"}
public static void RemoveProperty(Microsoft.Restier.Core.ApiBase api, string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of a property. |

### &#x20;SetProperty Extension

> [!NOTE]
>
> Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`

Sets a property.

#### Syntax

```csharp theme={"dark"}
public static void SetProperty(Microsoft.Restier.Core.ApiBase api, string name, object value)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `api` | `Microsoft.Restier.Core.ApiBase` | An API. |
| `name` | `string` | The name of a property. |
| `value` | `object` | A value for the property. |

### &#x20;SubmitAsync

Asynchronously submits changes made using an API context.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.Task<Microsoft.Restier.Core.Submit.SubmitResult> SubmitAsync(Microsoft.Restier.Core.Submit.ChangeSet changeSet = null, System.Threading.CancellationToken cancellationToken = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `changeSet` | `Microsoft.Restier.Core.Submit.ChangeSet` | A change set, or `null` to submit existing pending changes. |
| `cancellationToken` | `System.Threading.CancellationToken` | An optional cancellation token. |

#### Returns

Type: `System.Threading.Tasks.Task<Microsoft.Restier.Core.Submit.SubmitResult>`
A task that represents the asynchronous operation whose result is a submit result.

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`

## Related APIs

* System.IDisposable


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.