@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
93 lines (46 loc) • 1.51 kB
Markdown
---
lang: en
title: 'API docs: context.bindingcreationpolicy'
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.bindingcreationpolicy.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [BindingCreationPolicy](./context.bindingcreationpolicy.md)
## BindingCreationPolicy enum
Policy to control if a binding should be created for the context
**Signature:**
```typescript
export declare enum BindingCreationPolicy
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
ALWAYS\_CREATE
</td><td markdown="1">
`"Always"`
</td><td markdown="1">
Always create a binding with the key for the context
</td></tr>
<tr><td markdown="1">
CREATE\_IF\_NOT\_BOUND
</td><td markdown="1">
`"IfNotBound"`
</td><td markdown="1">
Create a binding if the key is not bound in the context. Otherwise, return the existing binding.
</td></tr>
<tr><td markdown="1">
NEVER\_CREATE
</td><td markdown="1">
`"Never"`
</td><td markdown="1">
Never create a binding for the context. If the key is not bound in the context, throw an error.
</td></tr>
</tbody></table>