> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/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

### <Icon icon="hammer" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> .ctor <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

## Properties

### <Icon icon="tag" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> 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

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> Dispose

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

#### Syntax

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

### <Icon icon="code-fork" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> Equals <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Parameters

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

#### Returns

Type: `bool`

### <Icon icon="thumbtack" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> Equals <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Parameters

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

#### Returns

Type: `bool`

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetApiService <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetApiServices <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

#### 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>`

### <Icon icon="code-fork" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetHashCode <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Returns

Type: `int`

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetModel <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

Retrieves the [IEdmModel](https://learn.microsoft.com/dotnet/api/microsoft.odata.edm.iedmmodel) used by this [ApiBase](/restier/api-reference/Microsoft/Restier/Core/ApiBase) 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](/restier/api-reference/Microsoft/Restier/Core/ApiBase) 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](/restier/api-reference/Microsoft/Restier/Core/ApiBase) instance.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetProperty <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetProperty <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetQueryableSource <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetQueryableSource <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetQueryableSource <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetQueryableSource <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetType <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Returns

Type: `System.Type`

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> HasProperty <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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`.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> MemberwiseClone <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Returns

Type: `object`

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> QueryAsync <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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.

### <Icon icon="thumbtack" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> ReferenceEquals <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Parameters

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

#### Returns

Type: `bool`

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> RemoveProperty <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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. |

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> SetProperty <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Restier.Core.ApiBaseExtensions`</Note>

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. |

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> 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.

### <Icon icon="code-fork" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> ToString <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

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

#### Returns

Type: `string?`

## Related APIs

* System.IDisposable
