---
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) &gt; [@loopback/context](./context.md) &gt; [ResolutionSession](./context.resolutionsession.md) &gt; [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&lt;[Injection](./context.injection.md)<!-- -->&gt;


</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


