a .NET-based Inversion of Control container for small projects & libraries.
Questions tagged [tinyioc]
75 questions
10
votes
1 answer
How to register a generic interface using TinyIOC
Suppose I have a generic interface and a generic implementation. How do I register all usages?
Specifically, I have the following (reduced for simplicity):
public interface IRepository where T : TableEntity
{
T GetById(string…

seldary
- 6,186
- 4
- 40
- 55
9
votes
1 answer
Configuring JsonNetSerializer and JsonNetBodyDeserializer using Nancy TinyIoC
I am a noob to Nancy. I have been using it as a framework to produce a REST API. I am familiar with Json.NET so I've been playing with the Nancy.Serialization.JsonNet package.
My goal: to customize the behavior (i.e. change the settings) of the…

Rob
- 145
- 1
- 6
9
votes
1 answer
TinyIoC: Register multiple interfaces on a single instance
Autofac allows resolving multiple interfaces to the same instance very easily with .AsImplementedInterfaces() or chained .As<>() calls together with .SingleInstance(). Can this also be done with TinyIoC? I've only found how to register multiple…

TeaDrivenDev
- 6,591
- 33
- 50
8
votes
1 answer
Registering dependencies within TinyIOC for use in NancyFX
I have another newbie question regarding registering additional dependencies within TinyIoc for use within NancyFX.
I am continuing to get the following exceptions when running the application...
Unable to resolve type:…

TheWeekendDeveloper
- 155
- 1
- 1
- 8
8
votes
3 answers
Getting TinyIoc current container in a Nancy project
I'm building a small Nancy web project.
In a method of one of my classes (not a nancy module), I would like to basically do:
var myThing = TinyIoC.TinyIoCContainer.Current.Resolve();
However, there is only one registration in .Current…

Alex
- 37,502
- 51
- 204
- 332
8
votes
3 answers
TinyIoC - Multiple Implementations of Interface
I am just beginning to learn about IoC and Dependency Injection. I am planning on doing a MonoTouch project and wanted to use TinyIoC but I wanted to test it out first. I'm creating a dummy credit card processing console app and I'm having trouble…

Ryan Alford
- 7,514
- 6
- 42
- 56
5
votes
1 answer
Constructor Injection with TinyIoC
I have just changed from Ninject to TinyIoC for dependency injection and I'm having trouble with constructor injection.
I have managed to simplify it down to this snippet:
public interface IBar { }
public class Foo
{
public Foo(IBar bar) {…

AndrewG
- 123
- 1
- 7
5
votes
1 answer
DI containers leak memory or BenchmarksDotNet MemoryDiagnoser delivers inaccurate measurements?
Introduction
We are trying to catch potential memory leaks using BenchmarksDotNet.
For the simplicity of example, here is an unsophisticated TestClass:
public class TestClass
{
private readonly string _eventName;
public TestClass(string…

foxanna
- 1,570
- 13
- 26
5
votes
0 answers
Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type
I have been trying to get stateless auth with JWTs working using Nancy on dotnet core. I am running this on an Ubuntu VM. But I keep running into a cannot resolve type error in my Startup.cs at x.UseNancy();
My startup class looks like this:
public…

user3574076
- 711
- 1
- 6
- 23
5
votes
1 answer
TinyIoC, Xamarin.iOS, linker settings
I'm trying to get TinyIoC working on Xamarin.iOS, but I'm not having a lot of luck. My project linker settings are set to "Link SDK assemblies only".
I'm literally doing something this simple:
public interface IPerson { int age { get; } }
public…

evenstephen
- 75
- 4
5
votes
2 answers
Nancy and/or TinyIoC does not respect AsSingleton()
The Setup: I have a almost out-of-the-box Nancy + TinyIoC setup running a webservice which works fine. It depends on various (AsSingleton) service classes. However these are not injected as Singletons, a new instance is created each time.
I have…

Mikkel Løkke
- 3,710
- 23
- 37
4
votes
1 answer
EntityFramework DbContext lifecycle + Postgres: "An operation is already in progress."
I have been messing with the following for a few days now.
I have a Nancy app running on Mono, with EntityFramework with Repository pattern and UnitOfWork, and Postgres. Nancy uses TinyIoC as it's IoC container.
I have a web app that queues requests…

Corstiaan
- 1,114
- 15
- 34
4
votes
1 answer
Nancy create singleton with constructor parameters
I'm using Nancy with TinyIoC to solve the dependencies.
One dependency in particular needs to be application-lifecycle singleton.
If I do it with a default constructor it works:
container.Register().AsSingleton(); // WORKS
but if i try…

Vetras
- 1,609
- 22
- 40
3
votes
1 answer
Resolving dynamically registered services by key in .NET Core
I'm migrating a tool to a .net 5 console app. I would like to change my DI system, currently a modified version of TinyIoC, to use if possible the built-in DI. Currently, my tool will load and auto-register any dll it finds in its config file.…

bbsimonbb
- 27,056
- 15
- 80
- 110
3
votes
2 answers
Do IDisposable objects get disposed at the end of a Nancy request using the RequestContainer?
I'm registering a DbContext onto the TinyIoCContainer that's passed into the ConfigureRequestContainer method on the DefaultNancyBootstrapper.
Whilst this works fine, I've noticed that the Dispose method on the context is never called once a request…

Tom
- 2,321
- 2
- 18
- 29