private static void AddMappingServices(this IServiceCollection services) { var mapperConfigExpression = EntityConverter.GetDefaultMapperConfiguration(new string[] { typeof(ClientMapping).Assembly.GetName().Name }); services.AddSingleton(mapperConfigExpression); services.AddScoped <IEntityConverter>((ctx) => { var scope = ctx.GetService <ILifetimeScope>(); return(new EntityConverter(ctx.GetService <Action <IMapperConfigurationExpression> >(), scope.Resolve)); }); }