Check out Getting Started with Knockout if you haven't already to learn how to get a new Coalesce Knockout project up and running.
Below you will find a brief overview of each of the different pieces of code that Coalesce will generate for you when you choose the Knockout stack.
Coalesce generates a number of different types of TypeScript classes to support your data through the generated API.
One view model class is generated for each of your Entity Models and Custom DTOs. These models contain fields for your model Properties, and functions and other members for your model Methods. They also contain a number of standard fields & functions inherited from
BaseViewModelwhich offer basic loading & saving functionality, as well as other handy utility members for use with Knockout.
See TypeScript ViewModels for more details.
- List ViewModels
One ListViewModel is generated for each of your Entity Models and Custom DTOs. These classes contain functionality for loading sets of objects from the server. They provide searching, paging, sorting, and filtering functionality.
See TypeScript ListViewModels for more details.
- External Type ViewModels
Any non-primitive types which are not themselves a Entity Models or Custom DTOs which are accessible through the aforementioned types, either through one of its Properties, or return value from one of its Methods, will have a corresponding TypeScript ViewModel generated for it. These ViewModels only provide a
KnockoutObservablefield for each property on the C# class.
see TypeScript External ViewModels for more details.
As you add your own pages to your application, you should add additional partial classes in the
/Controllers that extend these generated partial classes to expose those pages.
- Provides a basic table view with sorting, searching, and paging of your data.
- Provides the table view, but with inline editing in the table.
- Provides a card-based view of your data with searching and paging.
- Provides an editor view which can be used to create new entities or edit existing ones.
- Provides a minimal amount of HTML to display an editor for the object type. This is used by the
showEditormethod on the generated TypeScript ViewModels.