Presenting a purpose-built model

A Razor view renders a presentation model. A view model limits data sent to the browser and avoids binding a persisted entity directly to a form.

.NET
</>
practical skills

Contenu de la leçon

Cette leçon est encore concise. Utilisez le résumé, la vidéo éventuelle et le plan du chapitre pour avancer, puis validez vos acquis avec le quiz disponible.

Presenting a purpose-built model

A Razor view renders a presentation model. A view model limits data sent to the browser and avoids binding a persisted entity directly to a form.

Start with a minimal example, observe the result, then change one thing at a time. This helps distinguish the intended rule from accidental behavior.

Key points

  • Choose explicit names.
  • Verify the result with a simple case.