c# - Read-only field after INSERT with EF -


entity framework, code first

i have model lot of fields. 1 field ("name") not want editable read-only after insert. still want show field part of "edit" form (and viewmodel edit). i'd show readonly textbox (like @html.textboxfor(c => c.name, new {@readonly = "readonly"})) if change it's value browser dev.tools should not saved db.

is there beautiful way it?

now i'm getting instance db on , set "name" field of form data value db.

when processing viewmodel sent frontend, ignore "read-only" fields before saving them in database. afaik ef not support ignoring of properties.


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -