c# - Entity Framework Core , client side computed columns -
i trying find way have client side computed column in easy fashion. there possibility have computed columns on server via : https://docs.microsoft.com/en-us/ef/core/modeling/relational/computed-columns
what instead this:
modelbuilder.entity<person>() .property(p => p.deptname) .hasclientcomputedcolumn( (context, entity) =>{ return mystaticmap[entity.id]; });
is possible ef core?
if it's client-side column, don't need use entity framework. suggest implementing custom property getter in person
class, this:
class person { //other fields... public string deptname { { if(mystaticmap==null || !mystaticmap.contains(this.id)) { //initialize static map or throw exception } else { return mystaticmap[this.id]; } } } }
i've assumed deptname
property type string
, should change match needs.
Comments
Post a Comment