I use Entity Framework in my ASP.NET MVC 4.0 application and I want to know how to prevent or hide fields from my object that are generated in my strongly typed view? At the moment, in the view that I don't want, several primary key fields and timestamp fields are generated.
I know that setting the internal property, as opposed to public works, but I'm not sure if this will have the effect of a subsequent stream. I prefer to use property data annotations, but the ones I tried prevent Controller scaffolds or make them hidden. I prefer that they remain open, but simply are not generated in a strongly typed form.
EDIT:
To create a strongly typed view, add a new "view" in Visual Studio and select the class in the dialog box with which the image is modeled. This, in turn, will create a view with all the controls that are represented by the properties of the class. For example, the LastName field is created as follows:
@Html.EditorFor(model => model.FirstName)
Does anyone know how to do this?
Thanks!
atconway
source share