I am very new to WPF and am trying to set up an application that requires switching of views.
For example, a user is viewing a system that contains a number of components, when they click on a component, it should switch to a view that is associated to that component, replacing the previous system view. It's my understanding a Controlle...
I am writing an WPF MVVM application using Prism. A couple days ago I asked about best practices for managing different views and didn't get a whole lot of feedback. Sense then I have come up with a system that seems to work, but I want to make sure I wont get bit down the road.
I followed the tutorials at http://development-guides.silv...
I am trying to convert this code in my DI mapping from Unity to Structuremap but I cannot seem to get it to work. I am using Repository pattern like the one in found in shrinkr by Kazi Manzur Rashid found here http://shrinkr.codeplex.com/ Any help would be appreciated!
Unity Code:
....
private static readonly Func<LifetimeManager> per...
Hi fellow programmers,
I am using Microsoft Unity 2.0 and the interception extension is not working as expected.
Consider these two lines of code:
MyUnityContainer.Configure<Interception>().SetDefaultInterceptorFor<MyType>(new VirtualMethodInterceptor());
var someObject = MyUnityContainer.BuildUp<MyType>(anObject);
These two lines d...
Dependency injection stops working for all properties, except the one specified explicitly.
Controller:
public class MyController : Controller
{
[Dependency]
public int RefreshInterval { get; set; }
[Dependency]
public IReportService ReportService { get; set;}
Web.config:
<register type="My.Web.Controllers.MyControll...
Hello world!
I'm using Entity Framework and the Unity as IoC. I want to use constructor injection within entities with ability to configure them from both config and run-time. I don't want to use the injection via properties. I want to make it the way so I don't need and any handlers in object context that supports injection for my enti...
I have a concrete class of logger that Microsoft.Unity will Resolve ILogger to.
the logger class has two constructors
1. public logger()
2. public logger(List<BaseLogger> Loggers)
I have the unity section in my web.config file looking like this.
<unity>
<containers>
<container>
<types>
<type type="MyCompany.Logger.ILog...
With Unity, is it possible to register a parameter by name? My use case is the following. I want to register a value of type DateTime named "asOfDate" such that for any type that has a dependency on DateTime with constructor parameter named "asOfDate", Unity will serve an instance of DateTime equal to the registered value
...
How can I specify that constructor with no parameter should be used while creating the object? I know how to do it for the parameterized one but cannot find any help for the parameter less constructor.
I know how to do this through code but need solution for doing it through configuration.
...
Hi. I am using Dependency Injection pattern to resolve correct instance of mine UnitOfWork.
When I am using only one type mapping, all is ok
unityContainer.RegisterType<IUnitOfWork, UnitOfWork>();
The problem occurs when I am using two type mappings for the same interface:
unityContainer.RegisterType<IUnitOfWork, UnitOfWork1>(); ...
I have a question concerning how the Unity container I have set up is resolving controller dependencies. I've been searching around for an explanation of this but haven't found anything that is real clear on the subject. And maybe the answer is staring me in the face... Take a look at the following code that I'm sure many MVC guys hav...
I've worked with PRISM on one major project before so I'm pretty familiar with the concepts involved but I'm about to embark on a self managed project and was wondering if anyone has any pearls of wisdom about how to go about implementing an appropriate architecture for a straight forward LOB/Forms over data app. I'll want to leverage as...
Hi everyone.
I worked for about a year on a big Java based project which uses Struts2 for MVC support and Spring for DI, and now, because of a shift in company's management I have to migrate my whole project to .NET.
I started poking around with Unity and MVC2, and since I have to replicate my previous solution, I was wondering does Un...
Hi there.
I'm a first-time user of the AOP features of Unity 2.0 and would like some advice. My goal is to be able to log method calls in an ASPX page, like so:
public partial class Page2 : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[Log]
private void Testing()
{...
Hi everybody, I have a small toolkit which uses Unity DI plus EntLib Service Locator. The problem appears when a third party apps try to use the EntLib service locator. It looks like the EntLib Service Locator is singleton so when the third party app bootstrap its service locator, it wipes out the configuration of my service locator.
The...
Hi all,
I have the following code:
public static IEngine CreateEngine()
{
UnityContainer container = Unity.LoadUnityContainer(DefaultStrategiesContainerName);
IEnumerable<IStrategy> strategies = container.ResolveAll<IStrategy>();
ITraderProvider provider = container.Resolve<ITraderProvider>();
retur...
public class RichTextBoxExtended : RichTextBox
{
static RichTextBoxExtended()
{
//DefaultStyleKeyProperty.OverrideMetadata(typeof(RichTextBoxExtended), new FrameworkPropertyMetadata(typeof(RichTextBoxExtended)));
}
public byte[] Text
{
get { return (byte[])GetValue(TextProperty); }
set { SetVa...
Hello,
In my application we have a trace logger. We have log statements added at the beginning and end of most of the important methods tracing the method name and the parameter values. Now these trace statements are bloating the code and it is a bit of a pain to read through them.
I am considering how can I separate this aspect of the...
Hello, I beginning a new project and I need to create a Project for implementing Entity Framework 4.0 and Unity Framework 2.0 along with Enterprise Library 5.0.
I am very new to Entity Framework and Unity Framework and getting confused in how I can get normal Object BO's and DAL with Database.
Can someone point me to some simple exampl...
I have multiple versions of an assembly that each implements a type called RequestHandler (with IRequestHandler).
I want to configure unity each of the versions available using an alias like 'v1.1' or 'v1.2'.
At runtime requests are handled by the correct version using the alias to create an instance of the correct version of the assem...