Is there an interface in Zend Framework 2 that resembles the Zend_Registry component in Zend Framework 1. Is the Service Manager the only interface closest? I'm looking for a global registry.
Related
I have an ASP.NET Core web app (Dot Net Framework) in VS2017 for my REST Web API interface and I want to expose a controller defined in my external Dot Net Framework 4.5 library. I've added a reference to the library but the web app doesn't discover it. The library reference appears to be OK because I can create instances of other classes that are defined in it. I have no problems exposing the controller from an ASP.NET (DNF) web app.
I've also created a controller in the web app project that derives from ApiController (rather than Controller) but it doesn't get discovered either.
How do I get the web app to discover the external controller? Could I get it working using WebApiCompatShim?
There's no such thing as "Dot Net Framework". Generally, you have ".NET Framework", but that's a huge umbrella that covers a lot of stuff. Importantly, underneath that umbrella, you have things like .NET Core, .NET Framework (colloquially the "Full Framework"), .NET Standard, etc. It sounds like you're attempting to reference a Full Framework library in a Core application running on the Core Framework. If so, that's not possible. The Core app must be running on the Full Framework, as well, or your library needs to target a version of .NET Standard like 1.4, which is compatible with .NET Core.
One of application has below design:
Presentation layer:
1) MVC 4 (contains reference to WCF service) and using ninject DI for controller constructor inject - where interface and implementation are both on same project - MVC.
BAL and DAL
2) WCF Service
Converted to below design:
1) MVC (no service reference and removed ninject and only contains interfaces which are injecting into controller)
2) New library project (contain reference of MVC project and implementation of interfaces which are existed into MVC application) and added ninject module for DI.
3) WCF service
Problem:
When I execute the first design approach then, it works fine and I found, controller injected interface instance but, when I have make loosely couple for WCF service reference and added into new separate project and move each interfaces into that separate project then, on execution of MVC application, it gives me below error:
System.MissingMethodException: No parameterless constructor defined for this object.
this looks like issue due to ninject DI.
NOTE: In MVC, project, there is no NinjectWebCommon and ServiceModule both are moved into that newly added class library project. Interfaces which are injecting into controller are existed into MVC project and its implementation existed int newly added class library project.
Please suggest me what is wrong here.
thank You
We are having a new web project using C# / MVC 5, Entity Framework code first and Oauth 2 for authentication.
Here is how the solution is structured:
Project.DAL (Class Library): Contains EF DbContext and Repository classes
Project.BLL (Class Library): Contains business logic classes / Models
Project.Web (MVC Project)
But when we were building the project with individual authentication, the oauth part has automatically been created in Project.Web, should we move OAuth into BLL layer? Or what should we do to make the structure properly?
Thanks for your time
AsyncOAuth
Portable Client Library and HttpClient based OAuth library, including all platform(for PCL as .NET 4.0, .NET 4.5, Silverlight4, Silverlight5, Windows Phone 7.5, Windows Phone 8.0, Windows Store Apps).
Install
using with NuGet, AsyncOAuth
PM> Install-Package AsyncOAuth
I have a web application that I'm bootstrapping with Autofac and dependencies from common libraries are injected into controllers filters etc. Some of these dependencies are open generics and this all works fine.
In my web bootstrapper I'm doing it like this;
var builder = new ContainerBuilder();
builder.RegisterGeneric(typeof(OpenGeneric<>)).As(typeof(IOpenGeneric<>));
I now need to create an application that will be extensible (via plugins) that will consume some of these same dependencies. I'm using MEF for composing the application and extension discovery and hooking it up to Autofac using the Autofac.Integration.Mef nuget package:
builder.RegisterComposablePartCatalog(catalog);
I'm finding that my dependencies are not being injected when they are the generic dependencies (other interfaces and concrete types are fine) unless I explicitly supply the generic type like so:
builder.RegisterType<OpenGeneric<User>>().As<IOpenGeneric<User>>().Exported(x => x.As<IOpenGeneric<User>>());
I would really rather not have to supply each type that fulfils the constraint.
Is it possible to do this?
I understand that MEF itself does not support open generics but I thought this would be possible using the Autofac integration.
I have ASP .NET MVC 3 application and Class Library project, where i'd like to move all my controllers and then bind them using Ninject (controllers should be in .dll file).
Is it possible to bind controllers from assembly (.dll) using Ninject?
Yes, it is possible. The Ninject configuration is always performed in the ASP.NET MVC application which references all dependencies. So if your controllers are defined in a separate class library this assembly will obviously be referenced in your ASP.NET MVC application and you will be able to define your Ninject modules inside it.
A dependency injection container is always configured in the outermost layer of an onion architecture which for an ASP.NET MVC application is the web project itself because this layer has knowledge of the inner layers.