Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Knockout Generator
Knockout Generator

Knockout Generator

Andreas Gustafsson

|
8,221 installs
| (7) | Free
Generate C# Models to Knockout ViewModels
Download

More about the creator: 

Twitter: @angustafsson
Knockout Generator: Knockout Generator
Blog:  Andreas Gustafsson Blog 

 

Update 1.4

Added support for vs2013!

Update 1.3

Added options for CamelCasing and PascalCasing
Selection Generation, make a selection in a C#/vb file and right click and click "Generate Knockout ViewModel"

For more info go to: Knockout Generator 1.3 

 

Adds a new Context menu item to your .cs/.vb files. Right click on a .cs/.vb (inside code window or in the solution window) file that has public properties, klick the new command "Generate Knockout ViewModel".

right click example

When you have clicked the new command a new window will popup with options for the new Knockout ViewModel.

options-camelcase

Here is how it works, the grid on the left side shows you all the properties in the Class, the textblock on the right side shows you a preview of what will be generated.
If you checkes a chebox the preview will update immediately.

Observable Checkboxes: Will make the property observable, list, arrays will be observableArray, ordinary properties will be observable
Ignore Checboxes: Will ignore the property and will not be generated

Here in the example I made the property "foo" and "fancypants", observables, because "fancyPants" is a list, it will be a observableArray, "foo" are a simple property and will therefore be an ordinary observable.

When you are done, click the "Copy to clipboard" button, and you will get exactly what's in the preview box in your clipboard, paste it where you want it,
Here is my paste:

function Example(example) {	var self = this;	self.foo = ko.observable(example.foo || '');	self.bar = example.bar;	self.stringArray = example.stringArray;	self.fancyPants = ko.observableArray(example.fancyPants || [ ]);}

Knockout generator are easy to use and very convenient to use.

 

Properties that is private will not be included.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft