Skip to content

Commit

Permalink
Merge pull request #520 from dotnet-campus/main
Browse files Browse the repository at this point in the history
Fix code format in how-to-implement-dependency-injection.md
  • Loading branch information
stevemonaco authored Nov 6, 2024
2 parents 0bfde69 + 2a846fe commit 7b9e729
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ dotnet add package Microsoft.Extensions.DependencyInjection
The following code is creating an extension method for `IServiceCollection` that will register services to our service collection and make them available for injection.

```csharp
public static class ServiceCollectionExtensions {
public static void AddCommonServices(this IServiceCollection collection) {
public static class ServiceCollectionExtensions
{
public static void AddCommonServices(this IServiceCollection collection)
{
collection.AddSingleton<IRepository, Repository>();
collection.AddTransient<BusinessService>();
collection.AddTransient<MainViewModel>();
Expand Down

0 comments on commit 7b9e729

Please sign in to comment.