Is it possible to use the Unity Policy Injection within StructureMap to provide AOP functionalities? - unity-container

I know that we can use Castle Dynamic Proxy within StructureMap to implement the AOP mechanism. A typical example is: HERE But can we use Unity Policy Injection within StructureMap instead of Castle Dyanmic Proxy?

Have you considered doing your AOP natively with StructureMap? Have a look at the StructureMap documentation on interception.

Related

Is OWIN a Dependency injection container or DI framework?

We have an ASP.NET 4.8 project and we thought to introduce Dependency injection principle. A colleague suggested to use OWIN as DI container.
I tried to search for more information regarding ownin, but I don't seem to get the relation between owin and dependency injection.
Can OWIN be used as dependency injection container like some other frameworks: Autofac, Ninject, etc?

Approach for creating RestFul web services in Spring?

I want to develop RestFul web service using Spring. When I googled, I found that it can be done in two ways. One way is to use Spring's own Spring MVC and the other way is to use Jersey (or any other JAX-RS implementation) that provides support for Spring. I would like to know which approach would be better.
There’s something to be said for the cleanliness that is inherent to the JAX-RS spec. Whereas the Spring MVC approach is sufficient, JAX-RS is targeted solely to implementing REST APIs. Spring MVC isn’t built for that purpose alone and personally, I think it shows. Sometimes it can be a bit verbose or confusing.
For example, if you omit a method on a Spring MVC REST controller, Spring MVC happily assumes you want to have this endpoint available for all HTTP methods. For MVC purposes, this might be okay, for REST, this is not. And if you add the method to the #RequestMapping, you suddenly can’t use the terse notation and need to explicitly declare the value parameter on the notation. Same thing with setting explicit MIME types for an endpoint.
At the moment, I haven’t found anything that Spring MVC can do for REST which JAX-RS couldn’t.
P.S. It's the developer's choice. Technically one can build the same web service with both.

Dependency Injection using web.config in ASP.NET MVC 5

I'd like to utilize Dependency Injection in ASP.NET MVC 5. The mappings between types and interfaces need to be stored in web.config. Is there anything built-in the ASP.NET MVC 5 for dependency injection from web.config? Or, do I use Unity?
I often think that people are over-eager to define configuration
files. Often a programming language makes a straightforward and
powerful configuration mechanism.
- Martin Fowler
If you are new to Dependency Injection, do not use XML (or web.config) for configuration. XML configuration is a very old technology, and tends to be verbose and brittle.
Instead, you want to use CODE AS CONFIGURATION unless you need late binding. Mainly, you want to use generics and Fluent Builders used by configuration APIs.
Yes, you can use Unity container, if you really want to use XML-centric of DI Container.
You can read more about XML vs Code configuration at Dependency Injection in .NET (Paperback) by Mark Seemann - Page 67.

Using spring saml without other spring frameworks

Is it possible to use the Spring Security SAML extension without using other Spring libraries and projects?
I am trying to using Spring SAML libraries in an existing project written in pure Java. I do not intend to use Spring MVC and other libraries. Do I still have to use the securityContext.xml , ContextLoaderListener and DelegatingFilterProxy referenced in web.xml?
Spring SAML security extension relies on the Spring IoC container. You don't need Spring MVC.

Use Rhino Service Bus on ASP.NET website with Ninject

I will like to add Rhino Service Bus to my ASP.NET web application but using Ninject as the DI Container. So far all examples I keep seeing use Castle Windsor which I don't want to use since we already use Ninject.
Are there any tutorials out there which show how to add Rhino Service Bus to an ASP.NET web application without a direct dependency on Castle Windsor (e.g. using Ninject)?
Basically, you'd have to start by rewriting RhinoServiceBusFacility / AbstractRhinoServiceBusFacility as a Ninject module. Then there are also Castle references in other files, e.g. DefaultServiceBus has references to IKernel which should be changed to use Ninject's kernel instead.
Nowadays, Rhino Service Bus (RSB) does not directly depend on Castle. Modules are available for integration with Autofac, Spring.net, Unity, StructureMap and of course Castle.
Ninject isn't supported yet; you can use the Castle implementation as a reference implementation.

Resources