Language: C#
Design time / Run time VM
//Design time VM [Export] public ContactVM GetViewModel() { var contact = new Contact() { FirstName = "John", LastName = "Doe", City = "Design time", Address = "123 Any Street", State = "XXY", Zip = "99999" }; var currentContactService = new CurrentContactService(); currentContactService.Contact = contact; return new ContactVM(currentContactService); } //Runtime VM [Export] public class ContactVM { public ContactVM() {} [ImportingConstructor] public ContactVM(ICurrentContactService contactService) { Contact = contactService.Contact; } public Contact Contact { get; private set; } }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

