Skip to content

Sample Code does not register analytics client as singleton #115

@dzins

Description

@dzins

Describe the bug
Your sample code for both Asp.Net and Asp.Net MVC you register the analytics client as scoped which effectively makes them per request but from what I am gathering it seems like it should be registered as a singleton, why are they registered as scoped?

Can you update somewhere in your documentation explicitly stating that the analytics client is thread safe and can be registered as a singleton (if that is the case) and then change your sample code to register them as singletons?

To Reproduce
Steps to reproduce the behavior:
This sample code:
https://github.com/segmentio/Analytics-CSharp/blob/main/Samples/AspNetMvcSample/Startup.cs
https://github.com/segmentio/Analytics-CSharp/blob/main/Samples/AspNetSample/Startup.cs

Expected behavior
They should be registering the analytics client as a singleton.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions