Skip to content

Instantly share code, notes, and snippets.

@vtml
Created March 19, 2019 12:06
Show Gist options
  • Save vtml/1d93d3424504f696d18655f1d40755e6 to your computer and use it in GitHub Desktop.
Save vtml/1d93d3424504f696d18655f1d40755e6 to your computer and use it in GitHub Desktop.
Sitecore Super Power Friendly Dependency Injection
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