Can someone comment why Spring.NET libraries (Spring.Core, Spring.Services, Spring.Data, Spring.Data.NHibernate33) for Spring.NET 2.0.0.0 M2 release on Nuget are not strong name signed? I need to use these libraries in a COM+ project.
I am unable to register on Spring.NET community forum (the verification text image does not show up).
I think this must be an oversight/bug since there are similar issues in the spring.net forums for a previous release.
Related
I'm a little confused as to what integrated options I have for DI. I see it's pretty straightforward for .net core (for my particular projects), but I don't need to build a cross platform app and don't see the advantage to using core. However, it doesn't look like .net framework applications are still setup with Global.asax and without Startup.cs so does that mean there is no integrated DI option for .net framework 4.7? Do I still need to get a 3rd party solution or is there a way to use the same DI workflow in a .net framework project as is used in a core project?
Dependency Injection is not integrated by default in classic asp.net, you need to add a nuget package to handle DI (only integrated by default in asp.net core).
EDIT: Even though I found out how to do it as explained below, I still ended up going with Autofac because I didn't realize the Microsoft's solution only supports constructor injection, but not property injection.
I found instructions on how to do it here. I know link answers are bad, but I don't have time to do any more than this. If someone else wants to make an answer with full instructions I will mark it.
https://scottdorman.blog/2016/03/17/integrating-asp-net-core-dependency-injection-in-mvc-4/
Also note that if you are not using Owin already, it is not required. You can set it up just the same in Application_Start method of Global.asax. Only change you would need to make is when it references the Startup class in a statement that reflectively gets all the Controller classes, you will need to change that to be the class the code is in (or any other class in your assembly).
I'm having trouble getting started setting up dependency injection in my project.
Is there Microsoft provided functionality to do dependency injection with Mvc 5.2.3? If so where is it because I can't find it.
All the articles I can find are about the DI functionality in Core. According to Wikipedia that is the next version of Mvc. I'd rather just use what is built in to my version.
If nothing is built in, then I'll go do research myself on third party solutions.
There's no built-in DI functionality in ASP.NET MVC 5.2.3. You will need to use a third party DI container or write your own. If you are looking for one written by Microsoft you may checkout Unity.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Ioc/DI - Why do I have to reference all layers/assemblies in entry application?
I've decided to build a new MVC 3 application using Autofac as the DI container.
Since all my container configuration is done within the MVC project it forces a reference to all layers e.g. Data, which ideally the web project should have no idea about.
Is there a simple way to move this to a separate "fabric" class library? The problem I'm encountering is that I can't then configure the controllers in the fabric project as it would result in a circular reference between Fabric and MVC projects.
I understand that the reference is only used for configuration but not having the references will ensure a naughty developer doesn't start referencing the classes directly.
On a related note does anyone have any feelings about abstracting their DI container - or is this just getting carried away! As a rule of thumb I think it's good practise to wrap third party assemblies but at this level?
Thanks in advance,
Tom.
Since all my container configuration is done within the MVC project it
forces a reference to all layers e.g. Data, which ideally the web
project should have no idea about.
If you don't reference those layers, how do you expect the corresponding assemblies end up in your bin folder at runtime? You shouldn't be worried for referencing those layers in the MVC application.
but not having the references will ensure a naughty developer doesn't
start referencing the classes directly.
You should teach your developers good practices.
I'll try to explain in the simple way.
I have a solution (c# 4.0) that contain 4 projects
Framework
DAL
Domain
WebApplication
So my question is:
Framework is the right place to configure my Unity IoC? I want to configure via code and not with xml, so Framework need to know reference of DAL but DAL already knows Framework.
All my projects will know Framework, so where i configure my IoC?
Applications should be configured in the Composition Root, which is as close to the entry point as possible. In your case, that would be the WebApplication. That's the only project which should have a reference to Unity. None of the other projects should have any reference to Unity at all.
In the composition root, you should follow the Register Resolve Release pattern.
See also this answer - it talks about Ninject instead of Unity, but the concept (and hence the answer) is the same.
I'm currently reading Pro ASP.NET MVC Framework by Sanderson. In the book he recommends setting up IoC using Castle Windsor, and he points out that the download automatically installs it and registers the Castle DLLs in the GAC. Well, at this point in time (5/4/2010), the Castle Project no longer has a downloadable installer that sets this up. Its all broken out into their individual subprojects with the raw files contained in zipped folders. Sadly there's no installation documentation that I can find about how to set it up. Being the noob that I am, I'm stuck and now forced to ask #1 where should castle windsor live on my hard drive? #2 how do I manually register the dlls properly? And, #3 should I be angry at the project maintainers for their oversight?
Here's the link:
http://www.castleproject.org/castle/download.html
Sanderson's book is already somewhat outdated about the Castle - ASP.NET MVC integration.
There is no oversight here really, the Castle developers team decided that the project was getting too big to be efficiently managed, so they split it. So now each of these new projects ships as a separate bundle, which includes the necessary DLLs.
There is no installer because it's really not necessary. As with most open source .Net libraries (like NHibernate, log4net, Rhino.Mocks, Moq, and lots others) you get the DLL, put it in some directory in your project (most people call it lib or Dependencies), then from your project you add a reference to the DLLs in this directory. No need to mess with the GAC at all.
You also need to get MvcContrib (the one that says MVCContrib.Extras.release.zip), which implements the Windsor - ASP.NET MVC integration (controller factory and extensions to register controllers, among other things). In fact, MvcContrib already includes Windsor so that's all you really need.
You are looking for the Castle MicroKernel/Windsor project: http://www.castleproject.org/container/index.html
Here is a link to the "Getting Started" page:
http://www.castleproject.org/container/gettingstarted/part1/index.html
Once you have downloaded the ZIP file, extract it to a known location on your hardrive (inside the Visual Studio solution directory is normal).
Follow the "Getting Started" guide, it steps you through which DLL's to reference in your project, and how to use it
Good luck!