which one is better structure map or unity application block - asp.net

I want to use dependancy injection technique in my site. For that i want to choose either structuremap or unity application block. So which one is better and why we should use one of them?

There's a whole discussion on the two in this question.

Related

Symfony2: Where do I place my univeral helper class

I'm new to Symfony2 and would like to know the proper place to put my universal helper class. The helper class contains things like removeCurseWords, uplodFile, resizeImage, watermarkImage, convertDateToServerTime, doStuffHere and other things used by many but belong to none. I want this class to be accessible to all the bundles in my app so where do I place it to make it available to all.
Group those methods and put them in services (see http://symfony.com/doc/current/book/service_container.html). That way you can use them cross-bundle via the service container. You could have one service for all image operations and one for the rest which doesn't fit elsewhere.
If you have your php Library i suggest you to write a bundle that wrap it for symfony2 usage for, as example, expose the functionality as services container, manage the initialization, implement for type and so on for enable your library in yhe symfony2 way, then you can share via composer in other projects.
See this for further details.
Hope this help
I always create a folder called "Utils" at the same level as Controllers, Repositories, etc Found several people doing it that way too.

Where IOchardServices gets its concrete class set?

I am looking at the Orchard source and am looking for where the IOchardServices gets its concrete injected. I realize that all one has to do is specify the IOchardServices as a param in a controller constructor and it'll get injected, but I want to know where Autofac actually does it. I was looking at '/Orchard/Environment/OrchardStarter.cs' and there are many builder..... calls and so it looks like injection is occurring there; did a search in that file for IOchardServices and didn't find it.
The reason I'm interested in this is, I need to do property injection on aspx pages' codebehind since our team will only be able to slowly migrate over to Orchard CMS and we'll need to keep our existing pages as is, well without too much modification. I also assume that when we have our own custom interfaces we'll want to inject and will need to know the best place to do this.
The actual injection is done within Autofac itself, not in the Orchard code. The autofac-configuration is done by several autofac-modules within Orchard-modules.
When you want to migrate to Orchard, you can just start by first using Autofac without Orchard. Define logical interfaces and put the Autofac-configuration in application_start in your global.asax. See here and here for examples.

Do you store your helper classes in a separate assembly?

I just want to know if anyone stores their helper classes or methods in a separate assembly and why...just for clean management of them? I've seen so many posts about using a helper folder inside your MVC project and that brings me back to the messy old days in ASP.NET where people were using an App_code folder instead of cleanly separating things out physically like this into its own project.
And likewise nobody doing real architecture is going to put models in some folder in your MVC web assembly. They would go in MyApp.DataLayer assembly or MyApp.Models or something like this.
Yes, but for reasons, which are common to other assemblies as well
Becomes easy to plug into any other project.(might need some editions).
Reusable
Easy to improve
Easy to refractor
As not part of a project, but project
itself, it is easy to document and easy for developers to understand
Clears out some of the mess
But for all that above, your assembly, when ready, should be a "job well done", other wise, it is better to keep the helper classes to where they belong.
We have some helpers in a separate project and some in the web project. I think you'll find that some of your helpers need to use abstractions that you've defined in your web project itself. And that will often force you to put those helpers into the web project, because it's not likely desirable to have some other project that has a reference to the web project. I don't consider it the same as using App_Code. These are files that are compiled at compile time inside your IDE, with no special "magic" that gets applied to App_Code.
I use projects to separate out the different layers in my web or form apps. It allows me to respect the business rules better. Also I find it easier to track down where I need to go if I want to make a change.
But I have seen people use folders that label the layers in the solution but I think that is a little messy.
Yes, because they are part of the Business Layer. Two big payoffs:
Reusability
Testability
Keep in mind that your utility functions and helper classes are likely to be some of the most heavily used components of your entire system. Without full BICEP testing, you run a truly unacceptable risk.
Most helpers that I create are usually layer specific so I tend to keep them with the assembly the base assembly that needs them. I don't see a reason to add in another project to store a large number of specific helper classes.

using SqlSettingsProvider with asp.net

We want to move our asp.net settings from web.config to a database. All of the examples I see for SqlSettingsProvider are Winform apps.
Can SqlSettingsProvider be used with asp.net?
If not, can someone suggest an alternative?
Thanks
According to MSDN the SqlSettingProvider attribute can only be used for classes derived from ApplicationSettingsBase. As this class is Windows Forms specific and this is stated explicitly in the documentation it means you cannot use this functionality in a web context. (See http://msdn.microsoft.com/en-us/library/8eyb2ct1.aspx for details).
To work around this and get similar functionality I would advise you to create a custom SettingsProviderBase class and implement the setting storage strategy that you need. Using this approach will also allow you to unit test the classes that are depending on application settings.

Flex Custom Component Communication

What is the best practice in terms of communication (variable usage ann method calls) between custom components developed using mxml.
You could use Flash's built-in Event mechanism, which has no external dependencies.
http://livedocs.adobe.com/flex/3/html/help.html?content=events_01.html
You might want to implement one of the frameworks mentioned here: Flex MVC Frameworks. A proper architecture will allow you to communicate between components more easily. I use pureMVC in my current project.
Cheers.
PureMVC is pretty solid. It take a bit to get familiar with the design philosophy. But once you are set up it is pretty easy to code against and makes your project easy to grow and extend with solid MVC design principles.
The main thing about PureMVC is its concept is a concept of Notifications. You can pass around various objects in a simplified way throughout the system.
For an overview of PureMVC checkout
http://puremvc.tv
http://puremvc.org/
If you would like some more specific code examples or have specific questions let me know.

Resources