@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
95 lines (47 loc) • 1.65 kB
Markdown
---
lang: en
title: 'API docs: context.resolutionsession.runwithinjection'
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.resolutionsession.runwithinjection.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [ResolutionSession](./context.resolutionsession.md) > [runWithInjection](./context.resolutionsession.runwithinjection.md)
## ResolutionSession.runWithInjection() method
Run the given action with the given injection and session
**Signature:**
```typescript
static runWithInjection(action: ResolutionAction, injection: Readonly<Injection>, session?: ResolutionSession): any;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
action
</td><td markdown="1">
[ResolutionAction](./context.resolutionaction.md)
</td><td markdown="1">
A function to do some work with the resolution session
</td></tr>
<tr><td markdown="1">
injection
</td><td markdown="1">
Readonly<[Injection](./context.injection.md)<!-- -->>
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
session
</td><td markdown="1">
[ResolutionSession](./context.resolutionsession.md)
</td><td markdown="1">
_(Optional)_ The current resolution session
</td></tr>
</tbody></table>
**Returns:**
any