Azure / Azure/azure-functions-dotnet-extensions

Request: a simple README.MD for the "Scopes" example, explaining what is EXPECTED when people hit the HTTP trigger

Open
#24 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
81
Forks
50
PR merge metrics
No merged PRs in 30d

Description

:wave: Heya - just looking at the "Scopes" sample provided and I'm trying to understand the difference between `transient` and `scoped` life's _with respect to Azure Functions_. I totally grok it, with respect to an ASP.NET Core app + Request/Responses, etc.

It would be really nice if we could have a `README.MD` added to the scopes folder with example instructions & output. For example, the code says:

```
// Register MyServiceA as transient.
// A new instance will be returned every
// time a service request is made
builder.Services.AddTransient();

// Register MyServiceB as scoped.
// The same instance will be returned
// within the scope of a function invocation
builder.Services.AddScoped();
```

and the output for 1x HTTP request is:

```
{
"providersMatch": true,
"globalId": "db295a09-5458-4a60-a17e-ea538db8a586",
"serviceAId": "1678107f-c2e4-47eb-9514-0be4af5165dd",
"serviceBId": "1678107f-c2e4-47eb-9514-0be4af5165dd"
}
```

But I would have thought that `serviceAId` and `serviceBId` should be different?

So it would be really nice to explain how to see:
- a `transient` in action
- a `scoped` in action
- a `singleton` in action

with steps showing how to replicate and confirm this is occurring.

🙏 @fabiocav 🙏

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the Scopes sample folder and inspect the existing HTTP trigger and lifetime registrations. Run the sample with repeated service requests to document transient, scoped, and singleton behavior, including expected output. Done means a README.MD in the scopes folder provides reproducible steps and explains the observed IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.