cloudcrate / BlazorStorage

A library for Blazor local and session storage support.
MIT License
113 stars 19 forks source link

.AddStorage() extension should return IServiceCollection to enable fluent code #16

Closed codeclash closed 5 years ago

codeclash commented 5 years ago

Would be nice if you returned IServiceCollection here instead of void

Old:

public static class ServiceCollectionExtensions
{
    public static void AddStorage(this IServiceCollection col)
    {   
        col.TryAddScoped<LocalStorage>();
        col.TryAddScoped<SessionStorage>();     
    }
}

New:

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddStorage(this IServiceCollection col)
    {   
        col.TryAddScoped<LocalStorage>();
        col.TryAddScoped<SessionStorage>();
        return col; 
    }
}
LunicLynx commented 5 years ago

Good idea. Will do that the next time i'm adjusting something.

konradbartecki commented 5 years ago

Will resolve as part of #15 PR