Skip to content

MVC 6 Controls Toolkit Core Specifications #1

@frankabbruzzese

Description

@frankabbruzzese

Basic Features

Mvc 6 Version of the Mvc Controls Toolkit moves to GitHub! It will be redesigned from scratch for the future of the Web! Below the specifications:

  • Controls are implented with nested TagHelpers, containing custom templates and all controls parameters.
  • Client side scripting in TypeScript
  • A smart preferences framework takes care of options, user preferences, and browser capabilities(detected by Javascript code and properly packaged for the server).
  • No scripts generation in pages. Client Side scripting needed by controls will be enclosed in TypeScript files automatically created during project build.
  • The way Controls generate html and TypeScipt files is controlled by TagTranslationProviders. We will have providers for server side controls(whose full html is created on the server side) and for client side controls(based on client side templating). We will support at least a standard Server Controls provider, and Client Controls providers for Angular 2 and Knockout.js. However, we encourage the implementation of providers for other frameworks
  • Option to automatically compile some C# classes into TypeScript files, mapping some C# metadata into TypeScript MetaData annotations. The purpose is to export Server side ViewModel features on the client side, such as Validation and format rules.Compilation is controlled by the current TagTranslationProviders, so that the way TyepScript classes are created may depend on the client framework associated to the provider(knockout.js, Angular.js)
  • Advanced Validation and Globalization support both on the server side and on the client side.
  • Html5 input polyfills, and proper current culture based formatting. The way Html5 inputs are handled by ModelBinder automatically takes into account browser support and the way not supported features are simulated. Added Week and Month Week and Month .Net type and other smart features to handle properly Html5 inputs.
  • ViewModel transformation rules applied during Model Binding analogous to Mvc 5 Controls Toolkit
  • TypeScript files needed by controls are automatically included in the page during project build, by automatically operating on gulp configuration.
  • C# classes used by client side controls are automatically compiled into TypeScript classes and included in the script referenced by the page during project build.

TagTranslationProviders

The basic idea is to define a few basic operations, and then to define all controls TagHelpers in terms of this basic operations. This way each TagTranslationProvider needs just to implement these few operations. However, each TagTranslationProviders may completely override also the complete definition of an higher level tag, by putting its definition in a Tag dictionary.
TagTranslationProviders are injected with DI, by using asp.net 5 pipeline. A default TagTranslationProviders is configured in the asp.net 5 configuration, but developer may change the current provider both in the Views and in controllers Providers are retrieved through the framework name: "Server", "knockout", "Angular", and optionals attributes. The first provider for the selected framework, and with the require attributes (if any) is returned.

Templates

Templates used by controls may be defined either on line, or through Partial Views, or through ViewComponents, or through functions. Each template receives as input an options object, an Html prefix, and a a Model.

Validation

On the server side validation rules are defined by DataAnnotations+unobtrusive jquey Validation. For Client controls and client side templates validation is accomplished by translating sever side DataAnnotations into TypeScript metadata annotations.

Globalization

On the server side culture is handled by Asp.net 5 globalization logic. The same culture selected on the server side is reflected on the client side. For client side handling of globalization one might use the new version of the Globalize library that supports skeletons instead of date/number formats. Thus, it would be nice to add some skeletons support also on the server side with an utility class..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions