in Extensions

Knockout Generator 1.2

Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Google+0Email this to someone

If you haven’t seen it yet, I have built a Visual Studio Extension that generates a Knockout viewmodel based on your C#/Vb model.
The extension can be found here Knockout Generator.

Today I released version 1.2 that comes with a few new features, in the last versions the extension have been generating a complete new file and added it to the solution for your project, I have got some feedback and taken that away (for now).

When you generate a Knockout viewmodel on this version, you will get a options window, that let’s you choose what properties that should be observable, and what properties should be ignored. When you are done, you copy the ”file” to the clipboard, and can simply paste it where you think it belongs.

New features:

  1. Options window
  2. Only generate the viewmodel to the clipboard
  3. In parameter is the objects/class name

Bugg fixes:

  • C# arrays are now generated as arrays

Example:

Right click inside a C# file or VB file, (or in the solution window). And click the ”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.
knockout-generator-options-window

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.

knockout-generator-options-window-checked

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:

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

Here are some features I’m working on to the next release:

  • Options that tells you to have camelcase properties or not
  • Selection from a class and generate only the selection
  • Save a new file with the content where the user like

Right now, this is not opensource or at github, but will be soon!

Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Google+0Email this to someone

Write a Comment

Comment