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

|  Parameter | Type | Description |
|  --- | --- | --- |
|  action | [ResolutionAction](./context.resolutionaction.md) | A function to do some work with the resolution session |
|  injection | Readonly&lt;[Injection](./context.injection.md)<!-- -->&gt; |  |
|  session | [ResolutionSession](./context.resolutionsession.md) | _(Optional)_ The current resolution session |

**Returns:**

any


