How to set value of a property from iputs of View in auto generated partial class in asp.net MVC

asp.net-mvc c# entity-framework-6 partial-classes properties

Popular Answer

It is generally agreed upon that establishing a property should be relatively easy to do. Properties yield unexpected values when setter values are changed. In spite of the partial class issue, you may still do this, but keep in mind that EF will also utilise the setter when materialising.StdModel objects. You won't be aware if the database has an anomalous value.

Considering everything, I would either designate two delegate properties that, for instance, translate the value to the mapped property

public string StdNameSetToUpper
{ 
  get { return StdName; }
  set { StdName = value.ToUpper(); }
}

... or (better) use a view model that moves translated values from the user interface to the data layer.

0
8/26/2017 7:52:29 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow