Quick Start Guide (C#)

This information is also included in the readme.txt file installed along with the ViewModelGenerator.msi.

1. In order to install the View Model generator:
a. If you are using Microsoft Visual Studio 2008, then open a command prompt as an administrator. Navigate to the %PROGRAMFILES%\ViewModel Generator folder if you are using a x86. If you are using a 64-bit OS, then navigate to the %ProgramFiles(x86)%\ViewModel Generator folder. Execute the setup2008.bat file
b. If you are using Microsoft Visual Studio 2010 then follow the steps above, but rather then executing the setup2008.bat file execute the setup2010.bat file.
2. Create an XML file.
a. Open Visual Studio 2008 or 2010. From this point forward the steps are the same.
b. Open a project that contains an Entity Framework definition. If you are following the MVVM pattern then this will be your Model project.
c. Open (or create) a project to contain your ViewModels.
d. Add an XML file to the project.
e. Reference XML schema.
i. Click on the document editor containing the XML.
ii.In the properties window (F4), click on the Schemas entry. A list of XML schemas will appear.
iii. Click Add.
iv. Browse to the installation directory of the ViewModel Generator (either %PROGRAMFILES%\ViewModel Generator or %ProgramFiles(x86)%\ViewModel Generator)
v. Select the ViewModelOptions.xsd
vi. Close the form. It should now have a schema reference. This will assist when manually creating the ViewModel XML definition.
f. Enter the following values:
<ViewModelGenerationOptions file="AdventureWorks.edmx" project="CodeGenerator.Mvvm.Testing.Model"></ViewModelGenerationOptions>
g. Substitute the name of the EntityFramework file containing your definition. Be sure to use your project name rather than the one in the sample provided here.
h. Select your XML file in the project window.
i. View your Property Window (F4)
j. Set Build Action to Content
k. Set Custom Tool to ViewModelGenerator
l. Right click on your XML file in the project window and select Run Custom Tool. A C: file should have been generated which wraps all the properties of your EntityFramework class with View-friendly properties.

Last edited Jun 18, 2010 at 1:49 AM by jiwasz, version 2


No comments yet.