Created
March 19, 2019 12:06
-
-
Save vtml/1d93d3424504f696d18655f1d40755e6 to your computer and use it in GitHub Desktop.
Sitecore Super Power Friendly Dependency Injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO.Abstractions; | |
using System.Reflection; | |
using FileHelpers; | |
using Isobar.Foundation.DependencyInjection; | |
using Isobar.Foundation.SitecoreUtilities.Extensions; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.DependencyInjection.Extensions; | |
using Sitecore.DependencyInjection; | |
namespace Isobar.SampleProject.Infrastructure | |
{ | |
public class TooLazyServiceConfigurator : IServicesConfigurator | |
{ | |
private readonly IReflectionExtensions _reflectionExtensions = new ReflectionExtensions(); | |
public void Configure(IServiceCollection serviceCollection) | |
{ | |
serviceCollection.AddMvcControllers(_reflectionExtensions, "*Project*"); | |
serviceCollection.AddClassesWithDefaultInterface(_reflectionExtensions, "*.Foundation.*", "*.Feature.*"); | |
serviceCollection.AddClassesWithDefaultInterface(_reflectionExtensions, Assembly.GetExecutingAssembly()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment