Does OpenRasta support Unity 2.0 ?
The DI.Unity is build against Unity 1.2
https://github.com/openrasta/openrasta-unity -- Support for Unity 2.1+ now (Although it has been 9 months since the last answer to this question...)
OpenRasta is a framework for .NET as well as Unity2.0.
I found in documentation that OpenRasta supports Dependency Injection and IoC. So why mix them together?
If you already use Unity as IoC container I don't see any problem to resolve OpenRasta types. They are common types as others.
Related
Can Olingo v2.x and v4.x run in the same Java webapp side-by-side?
I know some libraries like Jackson 1.x and 2.x support this: a project can depend on both Jackson 1.x and 2.x, without conflicts
I'm using just Olingo 4, but as far as I know v2 and v4 are growing independently. I don't think it would be a problem to use them both.
And, in the worst scenario, you can use Olingo 2 for OData 2 and SDL OData Frameworks for OData 4, which are totally different libraries.
That should work. I've encapsulated olingo-odata2 and olingo-odata4 in their own Spring Framework based REST controllers and provide services side by side.
.NET Core/Standard 2.0 now lets you reference old .NET Framework libraries. You can install them via NuGet, and the code will build. This works within limits though:
"The supported scenario is referencing a .NET Framework library that happens to only use types within the .NET Standard API set." -- Announcing .NET Core 2.0
When using Topshelf from a .NET Core 2.0 application, I get the following exception:
There seems to be a dependency on System.ServiceProcess.ServiceAccount that is not satisfied. Is this dependency available within the .NET Standard 2.0 spec at all? If not, is there any other way I can get this to work?
TopShelf does not work on .NET Core 2.0 because it is missing some other fundamental APIs as well (most prominent one would be ServiceBase). Some missing types are being developed as NuGet packages for the 2.1 timeframe but this does not mean that TopShelf is instantly going to work. You can follow TopShelf's GitHub issue for .NET Core support for details and updates and even some replacement libraries for basic functionality if you must run on .NET Core until TopShelf will be able to work on .NET Core (basis of which I have written).
i can't seem to find a dependency injection framework for windows 8 metro apps.
Is there a framework for win8 metro apps?
Ninject is not yet support for win8 metro. So does anybody have a suggestion? (Castle, Spring, ...)
You could try Unity 3.0 for .NET4.5 Preview.
Here is the source for Ninject WinRT: https://github.com/remogloor/ninject
It just not yet released.
I've been using the Beta version of Autofac Portable Library (which is supported in Metro apps) and it is working great so far.
The Catel MVVM toolkit also contains a DI-container, it's metro version will be released this week (according to one of their developers): http://catel.codeplex.com
I've been looking for good dependency injection for ASP.NET MVC.
recently I am Java EE programmer, I always used Spring for DI Framework.
But after searching some tutorial from internet. Spring.NET requires explicit XML configuration for each controller that need to be injected.
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object id="HomeController" type="SpringTestApplication.Controllers.HomeController, SpringTestApplication" singleton="false">
<property name="TestProperty" value="This has been injected via Spring.Net"/>
</object>
</objects>
</spring>
And I think its very complected because there is no autowiring feature like Spring in Java World.
Can you suggest me the recommended DI Framework for ASP.NET MVC ?
Thanks in advance.
I wouldn't say there is a de facto recommended DI framework for the ASP.NET MVC framework. However, there's quite a few popular DI framework in the .NET world: Castle Windsor, Autofac, StructureMap, Ninject, Unity, Sprint.NET etc.
I would definitely recommend Ninject. The source can be found on github. There is a Ninject extension for the various versions of the ASP.NET MVC framework. The project also contains a sample application.
If you would like to have a look at an application using Ninject in the wild I would recommend the blog engine Subtext.
May I also suggest that you have a look at Mark Seemann's book: Dependency Injection in .NET. It covers some of the major frameworks for .NET. Unfortunately, it does not cover Ninject.
Castle Windsor, Ninject, Autofac are all good candidates
Personally I use Castle now.
For good example of how to set things up see
http://wiki.sharparchitecture.net/
I've used both Unity and Castle Windsor with MVC. Both are good, both have either XML or fluent API configuration.
I don't think there is a "preferred" framework. As the other answers show, you have multiple options, with spring.net being one of them.
With regard to spring.net:
there is a CodeConfig project that you might like
Visual Studio support for working with xml configuration has improved somewhat with the vs.net add-in, ReSharper helps too
asp.net mvc 2 is supported out-of-the-box with version 1.3.1 (current version)
asp.net mvc 3 will be supported out-of-the-box with version 1.3.2, which is expected soon
You might want to take the above in consideration if you want to leverage your Spring Java skills by using spring.net.
You can use the CodeConfig approach like in the Java world :
http://springframework.net/#spring-code-config-1.0.1-released
A MVC sample is provided.
In Using StructureMap 2.5 to scan all assemblies in a folder, we can see that StructureMap uses AssembliesFromPath() to explicitly look for types to resolve. What is the equivalent of this in Microsoft Unity? Because Unity is such a generic term, searching for documents about this online is not that easy.
Update: Unity has something called an Assembly Matching Rule but its description does not communicate to me that it scans folders.
The Assembly Matching Rule is used for applying interception to classes constructed by Unity and not for container registration. Unity itself does not have any convention-based scanning functionality like StructureMap. There is a CodePlex project that adds similar functionality to Unity though. http://autoregistration.codeplex.com/
Registration by Convention was added in Unity 3.0. Nice examples of this feature are provided in "Developer's Guide to Dependency Injection Using Unity" in solution in samples named OtherUnitySamples. You can find the book here:
http://msdn.microsoft.com/en-us/library/dn178463(v=pandp.30).aspx
and code samples here:
unity.codeplex.com/downloads/get/683531