unity or mef ioc dependency injection

Jul 27, 2011 at 9:48 PM
Edited Jul 28, 2011 at 2:15 AM

I am trying to use mef or unity IOC(dependency injection) in a mvvm application

I am trying to use dependency injection inside my model classes  http://msdn.microsoft.com/en-us/library/ff953186(PandP.50).aspx

Lets pretend we have a simple model class


public  Class Hotel: DependencyObject


[Data Member]

Public const string  Name="Name";

Public string Name  

{ get return (string) GetValue(Name); }

{set {setvalue(Name,value):

public static readonly DependencyProperty Name =

DependencyProperty.Register (

Name (

type of (string) ,


new propertyMetadata(string));

Public string Address 

Public const string Address="Address"

{ get return (string) GetValue(Address); }

{set {setvalue(Address, value):

public static readonly DependencyProperty Name =

DependencyProperty.Register (

Address (

type of (string) ,


new propertyMetadata(string));

etc, etc  

Is this correct? Remember I am trying to set a model layer

 Is their anything  else that I need in my data classes??   

Jul 28, 2011 at 2:23 AM




the last example was too confusing on msdn