unity

Unity with a Linq to Sql DataContext. RegisterType or RegisterInstance

Here's the basic setup. On an ASP.Net website, there are a few pages that display reports from data that comes from a database. All the data comes via stored procedures that is accessed usign Linq to Sql. These pages may have some very high traffic at different times. We're using ASP.Net with the MVP pattern, and Unity for IoC (although ...

Using Unity in WPF Custom Controls.

I'm attempting to create a WPF custom control that includes a reference to the unity container that has been created in the BootStrapper - e.g. The reason being that I would like the custom control to be able to resolve the unity container to be able to use some of the services that have been registered to the container. e.g. a user pre...

Unity 2.0 Web.config settings with MVC

Hello, I am trying to use Unity 2.0 for my current project with MVC and having trouble configuring paramter injection in the web.config file. Here's what I have: 1) A Home Controller: public class HomeController : Controller { IRepository repository = null; public HomeController() { // Always calls this constructo...

How do I add a tracing interceptor for all classes within Prism?

I am trying to add a tracing interceptor to all the components of my Prism application using an interface interceptor. I almost have this working however the interceptor is having problems with interfaces that declare an event. Has anyone successfully implemented aop tracing for all components without the need for attributes? Here is ...

Unity application block 2.0 - The given assembly name or codebase was invalid.

Interfaces (In the assembly named "Interfaces". In project :- Interfaces) namespace Interfaces { public interface IDoSomeWork1 { string DoSomeWork1(); } } namespace Interfaces { public interface IDoSomeWork2 { string DoSomeWork2(); } } Dependencies (In the assembly named "Entities". In project ...

Optimal language to develop with Unity?

Hello everyone. I would like to ask you all about the Unity framework and programming. Unity supports three different languages; Boo, C# and JavaScript. Say you were new to programming and developing on OS X. What is the best language to learn and use alongside Unity to create games? ...

Please Help! Unity Interception and Performance Issues

Hi Recently we did some load testing on one of our MVC2 app, and we found out that every time when we hit 20 users web server CPU get maxed out. We spent so much and finally narrowed it down to Unity Interception. Our App uses Unity 1.2. The problem is in the below code Line 1 - unityContainer.Parent.AddNewExtension<Interce...

How to inject a generic IList<> of objects using Unity 2 XML config?

I need to inject a collection of type IList<IActivity> into a constructor. I am using Unity 2.0 and configuring it using XML. I was able to do this by just injecting an array in Unity 1.2. I have just upgraded to Unity 2.0 and my configuration has now stopped working in this specific area. (I have resolved all the trivial changes to the...

IRepository, IService, Unity in an ASP.NET MVC Application, reference question

I'm new to Unity, but this question is more generic to IoC, and I’m pretty new to implementing IoC as a whole. I have VS2010 solution with this project structure (simplified slightly): Business Objects – Folder DomainModel (Class Lib prj.) – Entity Framework 2 POCO entities Data Layer – Folder DataAccess (Class Lib prj.) – EF2 EDMX...

Unity: Am example of a bootstrapper file?

Hi there, does anyone have a good example of a boostrapper class i can see for reference.. I can't seem to find one anywhere, searched google but no luck. Searched the helpfile and no luck.. Any help really appreciated ...

Unity: How to registerType with a PARAMETER constructor?

Hi there, Can anyone help? How do i registertype with the container where the type doesn't have NO PARAMETER constructor. Infact my constructor accepts a string .. and i normally pass in a string that represents a Path. So when i do resolve it automatically creates the new type but passing in a string? Thanks in advance ...

Unity 2.0 XML configuration with generics

This is kind of a follow to my other post about Unity (http://stackoverflow.com/questions/3998559/irepository-iservice-unity-in-an-asp-net-mvc-application-reference-question). Basically I'm trying to register a generic type in the web.config. I've read a few posts and this SEEMS like it is configured correctly. <unity xmlns="http://s...

New Prism Project - Use MEF or Unity?

I'm starting a new personal Prism 4 project. The Reference Implementation currently uses Unity. I'd like to know if I should use MEF instead, or just keep to Unity. I know a few discussions have mentioned that these two are different, and they do overlap, but will I be missing out if I simply choose Unity all the way? ...

Javascript - what kind of declaration is this?

I come from other programming languages and I am new to Javascript. I am trying to understand what a Javascript code is doing. I found this line var guiTouchPos : Vector2 = touch.position - guiTouchOffset; What kind of declaration is this? What is this line doing? Wouldn't it be easy to write var guiTouchPos = touch.position - guiTo...

Unity Dependency Injection using a config file - cant resolve dependency

Hi All, I'm using my app.config to tell Unity my interface to type mappings... <unity> <containers> <container> <types> <type type="UnityDAL.Interfaces.IDataContextFactory, UnityDAL" mapTo="UnityDAL.UnityDemoDataContextFactory, UnityDAL" /> <type type="UnityDAL.Interfaces.IProductRepository, UnityDAL" ...

What is Castle Windsor's DependsOn Equivalent in Unity?

I use DependsOn for static dependencies such as connection strings. What is the equivalent function for Unity's Fluent interface? ...

Adding Unity dll reference to Silverlight 4 project

Hi All, This morning I had an unusual issue with my Silverlight 4 app. I have been a big fan of IoC frameworks, so decided I will use Unity for my project. But as soon as I added the assembly to my project, I got this following error. System.Windows.Markup.XamlParseException occurred Message=Could not load type 'System.Security.AllowP...

Unity Container Type Registration Quirk

Hi All, I'm trying to automatically register all reports in a unity container. All reports implement IReport and also have a Report() attribute which defines the title, description and unique key (so I can read these without instantiating a concrete class). So... I get the report types like this Public Shared Function GetClassesWhic...

Creating WPF ResourceDictionary from code doesn't seem to work when setting ResourceDictionary.Source

I have a project containing a xaml ResourceDictionary that I wish to use outside of a FrameworkElement. The resource dictionary will contain a DataTemplate for a class local to the project to avoid polluting the app.xaml (as the project is a prism module, and will not always be present depending on config). So, I have a test.xaml file w...

Unity 2 trouble referencing RegisterInstance using InjectonProperty

I have the following code: Unity Container: Settings settings = CreateSettings(); container.RegisterInstance(settings) .RegisterType<MyHttpHandler>(new InjectionProperty[] { // How do I tell Unity to inject my settings created above? new InjectionProperty("Settings", new Resolved...