tinyioc

Why is TinyIoC not picked up in my Xamarin.Android project when added using nuget?

拥有回忆 提交于 2021-01-29 08:35:56
问题 So I installed TinyIoC v1.3.0 using nuget in my Xamarin.Android project, its in the references, but I cannot type using TinyIoC; without a compile error. I would like to understand why this is? PS. I know I can use the TinyIoC.cs file directly, but I thought it would be more convenient to update if I added using nuget. I get this error: 回答1: I think the issue is related to the nuget package TinyIoC 1.3.0 itself. The nuget package does not contain the lib folder with the related dll so that

TinyIoC: Register multiple interfaces on a single instance

给你一囗甜甜゛ 提交于 2020-01-02 01:30:08
问题 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 implementations of the same interface, but there is no way of chaining registrations or the like. From my understanding this is a quite important feature for an IoC container, isn't it? 回答1: If I'm understanding correctly you have something like public

ReactJS.Net on MVC5 fails to resolve dependency

徘徊边缘 提交于 2019-12-24 02:23:41
问题 I'm trying to set up an ASP.Net MV5 application to work with ReactJS.Net, including server side rendering and bundling. Unfortunately, it fails with this exception: An exception of type 'React.TinyIoC.TinyIoCResolutionException' occurred in React.dll but was not handled in user code Additional information: Unable to resolve type: React.ReactEnvironment This exception occurs on this line: @Scripts.Render("~/bundles/ui-components") This line is taken my _layouts.cshtml file. How should I solve

How to register a generic interface using TinyIOC

给你一囗甜甜゛ 提交于 2019-12-23 07:49:52
问题 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<T> where T : TableEntity { T GetById(string partitionKey, string rowKey); void Insert(T entity); void Update(T entity); void Update(string partitionKey, string rowKey, Action<T> updateAction); void Delete(T entity); IQueryable<T> Table { get; } } public class AzureRepository<T> : IRepository<T> where T :

C# IOC and Request State in NancyFX

∥☆過路亽.° 提交于 2019-12-11 14:33:59
问题 I want to inject a class into my module using the IOC framework in NancyFX, and I want that class to have access to the Context, just like the module does. How would I do that? The module has a property called Context, that doesn't seem to be injected (nor should it be, as it is the request state)... how does that work, and is that thread safe? Thanks 回答1: Assuming you use the DefaultNancyBootstrapper as a base for your bootstrapper you register your dependency in your container on a per

TinyIoC, Xamarin.iOS, linker settings

时间秒杀一切 提交于 2019-12-07 11:00:58
问题 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 class Person : IPerson { public int age { get { return 99; } } } Then my registration code looks like this (I've just placed it in my AppDelegate in a toy app): TinyIoCContainer.Current.Register<IPerson,Person>.AsMultiInstance(); When I attempt to

Constructor Injection with TinyIoC

给你一囗甜甜゛ 提交于 2019-12-05 01:49:52
问题 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) { } } public class Bar : IBar { public Bar(string value) { } } class Program { static void Main(string[] args) { var container = TinyIoCContainer.Current; string value = "test"; container.Register<IBar, Bar>().UsingConstructor(() => new Bar(value)); var foo =

Configuring JsonNetSerializer and JsonNetBodyDeserializer using Nancy TinyIoC

妖精的绣舞 提交于 2019-11-30 03:38:52
问题 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 JsonNetSerializer and JsonNetBodyDeserializer . Specifically I'd like to incorporate the following settings... var settings = new JsonSerializerSettings { Formatting = Formatting.Indented }; settings.Converters.Add( new StringEnumConverter {

EntityFramework DbContext lifecycle + Postgres: “An operation is already in progress.”

假装没事ソ 提交于 2019-11-28 09:31:41
问题 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 on the front-end so the back-end gets hit one request at a time. This all works fine. However, the trouble starts when I run an iOS app that connects to the same back-end and does not queue requests to the backend, firing request sometimes almost

Registering dependencies within TinyIOC for use in NancyFX

一笑奈何 提交于 2019-11-28 00:22:32
问题 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: AdvancedSearchService.Interfaces.IResponseFactory Exception Details: TinyIoC.TinyIoCResolutionException: Unable to resolve type: AdvancedSearchService.Interfaces.IResponseFactory Source Error: Line 25: var container = TinyIoCContainer.Current; Line 26: Line 27: