Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

ServiceLocator with Autofac in asp.net core 3.1

I'm developing an asp.net core 3.1 webapi application and i'm using Autofac as DI container. For one particular case i cannot use ConstructorInjection nor propertyinjection nor methodinjection. My ...
simone_Vin's user avatar
0 votes
0 answers
396 views

How to implement DI in Xamarin Forms w/o using a Service Locator pattern?

When I do DI in MVC, I can do it without out using a service locator pattern in any of my own code. However, as I understand it, under the hood there is a service locator pattern that's already being ...
BVernon's user avatar
  • 3,707
0 votes
0 answers
175 views

Xamarin.Forms - Unit Testing a method that uses ServiceLocator from Autofac

I am trying to unit test a method in my MyViewModel which extends from BaseViewModel. The BaseViewModel has a method like this protected bool DoSomething() { if (something) { ...
pixel's user avatar
  • 10.5k
1 vote
1 answer
990 views

Jenkins cannot use MSBuild but Visual Studio can build

I have a UWP project, in visual studio 2017, it can build without a problem. But when I write script to build in Jenkins, I use below command: nuget restore MySolution.sln MSBuild.exe MySolution.sln ...
spspli's user avatar
  • 3,298
2 votes
1 answer
2k views

Autofac resolve service implementation during registration

I am trying to put the code in one place for resolving Keyed services using Autofac. I have an interface: public interface IShipManagerService { } Two implementations: public class ...
JDBennett's user avatar
  • 1,493
3 votes
1 answer
2k views

Moq Service Locator for unit test

I am trying to figure this out but no success. how can I mock ProcessorLocator for these two tests? Here is my ServiceLocator: public class ProcessorLocator : IProcessorLocator { public static ...
Mert's user avatar
  • 6,562
2 votes
3 answers
2k views

Using Dependency Injection (Autofac) and avoiding Service Locator pattern

I'm taking a stab at properly implementing DI in my Xamarin Android application using Autofac but I'm having issues understanding how I should handle instantiating objects that require data passed ...
NastyNate's user avatar
1 vote
2 answers
1k views

Autofac dynamic invocation with Func and Dependency Injection

Providing that I have a class as follows public class Foo { public Foo(string someTitle, IFooService fooService) { // do stuff } } I know that I can instantiate it like this ...
Chase Florell's user avatar
0 votes
2 answers
1k views

How to register types in IOC container, but in a container agnostic way?

*I have an application which uses an IOC container (Autofac, but could be any). I also have modules which are developed externally. Each module needs to specify its own setup of the DI container, ...
peter.swallow's user avatar
1 vote
1 answer
2k views

asp.net mvc 4 dependency resolver for controllers

I'm using asp.net mvc 4 to develop a multi-tenant mvc application. I am using Autofac for the IOC container and have configured controllers to be registered for each client in different assemblies. ...
Daniel Powell's user avatar
2 votes
2 answers
1k views

IoC: Dependency Injection and overall instances between assemblies

I heared this should be possible, but I can not imagine how this should work. I am using Dependency Injection (autofac) for my project. I develop a project with someone else and call the methods of ...
user437899's user avatar
  • 9,229
3 votes
1 answer
180 views

.NET IoC: Preconfiguring library components for easier use

I had a similar question a while back, but with much less of a grasp of the whole IoC/DI topic and as well as what I was aiming to achieve, so here goes again.... I am building a library for common ...
TeaDrivenDev's user avatar
  • 6,619
1 vote
1 answer
4k views

Autofac, ASP.NET and Microsoft.Practices.ServiceLocation

I've been working thru the details of implementing IoC in my web apps but in a way that leverages Microsoft.Practices.ServiceLocation. I am specifically using Autofac and the asp.net integration, but ...
n8wrl's user avatar
  • 19.7k