Skip to content

Instantly share code, notes, and snippets.

Created Sep 8, 2018
What would you like to do?
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace JrTech.AspNetCore.Web
public class Startup
public Startup(IConfiguration configuration)
Configuration = configuration;
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
services.Scan(scan => scan
.FromApplicationDependencies(a => a.FullName.StartsWith("JrTech"))
.AddClasses(publicOnly: true)
.AsMatchingInterface((service, filter) =>
filter.Where(implementation => implementation.Name.Equals($"I{service.Name}", StringComparison.OrdinalIgnoreCase)))
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
if (env.IsDevelopment())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment