Skip to content

[TypeScriptPartial]

Note

This attribute only applies to the Knockout front-end stack. It is not applicable to the Vue stack.

If defined on a model, a typescript file will be generated in ./Scripts/Partials if one does not already exist. This 'Partial' TypeScript file contains a class which inherits from the generated TypeScript ViewModel. The partial class has the same name as the generated ViewModel would normally have, and the generated ViewModel is renamed to "<ClassName>Partial".

This behavior allows you to extend the behavior of the generated TypeScript view models with your own properties and methods for defining more advanced behavior on the client. One of the most common use cases of this is to define additional Knockout ComputedObservable properties for information that is only useful in the browser - for example, computing a css class based on data in the object.

Example Usage

c#
[TypeScriptPartial]
public class Employee
{
    public int EmployeeId { get; set; }

    ...
}

Properties

public string BaseClassName { get; set; }

If set, overrides the name of the generated ViewModel which becomes the base class for the generated 'Partial' TypeScript file.


Coalesce is a free and open-source framework created by IntelliTect to fill our desire to create better apps, faster. IntelliTect is a high-end software architecture and development consulting firm based in Spokane, Washington.

If you're looking for help with your software project, whether it be a Coalesce application, other technologies, or even just an idea, reach out to us at info@intellitect.com — we'd love to start a conversation! Our clients range from Fortune 100 companies to local small businesses and non-profits.