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

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -