Questions tagged [funq]

For issues relating to the Funq Dependency Injection framework.

Funq is lightweight Dependency Injection container optimised for good performance and memory usage.

It's widely used as ServiceStack's Inversion Of Control container.

64 questions
2
votes
1 answer

Funq scope in ServiceStack (Best Practice)

In my Web application I use a standard mechanism for resolving dependencies into a AppHost.cs public virtual void Configure(Container container){ } In this method, I register all dependencies. How can I access Container instance out of…
user1376723
  • 257
  • 2
  • 6
1
vote
1 answer

Why would one need this lambda: Function(x) x

I found this line in an old branch and, as I have a lot of respect for the (unreachable) author, I'm trying to make sense of one specific line, more precisely the lambda at the end: container.Register(Of…
laancelot
  • 3,138
  • 2
  • 14
  • 21
1
vote
1 answer

Funq: Register the same object multiple times and using an identifier (from session) to resolve them

What I currently have: I have a simple dictionary of type string, DbContext I am registering my Dictionary like this container.Register>(x => dbContexts).ReusedWithin(ReuseScope.Request); and using the dictionary…
Marco Siffert
  • 535
  • 1
  • 6
  • 22
1
vote
1 answer

Using ServiceStack's Funq to LazyResolve dependencies

We are using ServiceStack in a web hosted API service, and have done so for awhile now. The execution path for any request follows the pattern: Request comes in: --> Service (handles request, utilizes IManager injected via constructor) --> IManager…
StratMN
  • 161
  • 8
1
vote
1 answer

ServiceStack IServiceGateway in Non Service/Non Controller and IOC

I have a console app with hangfire and service stack services into. Hangfire has its own IOC Adapter Implementations which has been integrated into a Funq adapter. I'm trying to use an IGatewayService to make calls to an inproc service. The…
lucuma
  • 18,247
  • 4
  • 66
  • 91
1
vote
1 answer

How to implement nhibernate session per request pattern, using Service stack's funq container as a dependency injector

I am getting the session by injecting session to service method in global.asax as 1 protected void Application_Start() { this.RegisterContainer(); } 2 private void RegisterContainer() { container.Register(c => new …
Raghu
  • 11
  • 5
1
vote
1 answer

ServiceStack.Funq.Quartz cannot instantiating type?

ServiceStack.Funq.Quartz Sample Code is public class MyServices : Service { public object Any(Hello request) { return new HelloResponse { Result = "Hello, {0}!".Fmt(request.Name) }; } } public class HelloJob : IJob { …
ali
  • 11
  • 2
1
vote
1 answer

ServiceStack's Funq & ElasticSearch

I am trying to wire up ElasticClient using ServiceStack's Funq, but I am getting a null reference exception when trying to call it. Here is my set up: In AppHost.cs: var elasticSettings = new ConnectionSettings(new Uri("http://localhost:9200"),…
Mark
  • 2,175
  • 20
  • 23
1
vote
1 answer

Application design - ServiceStack; OrmLite.MySql; Funq; IDbConnection; Quartz

We have a ServiceStack service (API) which provides HTTP endpoints hosted using AppSelfHostBase. Those services later query database using ServiceStack.OrmLite.MySql. All methods are implemented using async / await pattern. Database connections are…
1
vote
2 answers

ServiceStack Funq ReuseScope.Request injects same object instead of a new instance

I'm having a problem with ReuseScope.Request. I'm getting the same instance injected on every request even though I specify ReuseScope.Request. I configured the container using these two calls to get a…
Bryan Cox
  • 278
  • 2
  • 6
1
vote
0 answers

ServiceStack testing methods that works with EF

As an answer to my own question: What would be the most elegant way to use Entity Framework with Generic Repository, in Service Stack, and to write Integration \ Unit Tests for service? At the moment, this is how my structure looks like: Generic…
ShP
  • 1,143
  • 1
  • 12
  • 41
1
vote
0 answers

Funq.Container.RegisterAutoWire() does not inject class property automatically within ServiceStack

I'm using ServiceStack 4.0.34. Container.RegisterAutoWire() method works, but when I create an instance of the registered class, no autowiring happens unless I manually call HostContext.Container.AutoWire(this) in the class constructor. I've read…
1
vote
1 answer

Strategy for resolving correct interface implementation in multi-tenant environment

Given this interface: public interface ILoanCalculator { decimal Amount { get; set; } decimal TermYears { get; set; } int TermMonths { get; set; } decimal IntrestRatePerYear { get; set; } DateTime StartDate { get; set; } …
Stephen Patten
  • 6,333
  • 10
  • 50
  • 84
1
vote
2 answers

How to Use the ConnectionString on Funq.Container?

How can you leverage the connection string property when initializing a registered type with the Funq.Container? ServiceStack shows how to include a connection string while registering a type with the IoC container (Funq.Container) but I cannot…
Ryan D'Baisse
  • 837
  • 11
  • 29
1
vote
1 answer

SignalR Funq Dependency

I'm trying to inject Signalr dependencies with Funq D.I. The process is explained pretty well here and I tried also to follow this question. and the Ninject version works pretty well. Now I am trying to convert it to a Funq version using this gist…
Ronnie
  • 4,959
  • 10
  • 51
  • 69