toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 261 forks source link

Change service extension return type #400

Closed maxbanas closed 3 years ago

maxbanas commented 3 years ago

Most IServiceCollection extension methods return the IServiceCollection instance passed in. This change updates the AddRazorLight method to be consistent, so that something like this is possible:

var serviceProvider = new ServiceCollection()
    .AddRazorLight(() =>
        new RazorLightEngineBuilder()
        .UseEmbeddedResourcesProject(typeof(Program))
        .UseMemoryCachingProvider()
        .Build())
    .AddSingleton(new MyService())
    .BuildServiceProvider();
jzabroski commented 3 years ago

I'll ship rc4 this week. Hoping to figure out the unmanaged dll issue