---
lang: en
title: 'API docs: context.asclassorprovider'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.asclassorprovider.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [asClassOrProvider](./context.asclassorprovider.md)

## asClassOrProvider() function

A factory function to create a template function to bind the target class as a class or `Provider`<!-- -->.

**Signature:**

```typescript
export declare function asClassOrProvider<T>(target: Constructor<T | Provider<T>> | DynamicValueProviderClass<T>): BindingTemplate<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  target | [Constructor](./context.constructor.md)<!-- -->&lt;T \| [Provider](./context.provider.md)<!-- -->&lt;T&gt;&gt; \| [DynamicValueProviderClass](./context.dynamicvalueproviderclass.md)<!-- -->&lt;T&gt; | Target class, which can be an implementation of <code>Provider</code> or <code>DynamicValueProviderClass</code> |

**Returns:**

[BindingTemplate](./context.bindingtemplate.md)<!-- -->&lt;T&gt;


