What am trying to achieve is to create a class as shown below.
public class Purse
{
public decimal AvaliableBalance { get; protected set; }
public decimal PendingBalance { get; protected set; }
public decimal TotalBalance { get; protected set; }
}
But am wondering if entity framework will be able to populate this class. If so, how?
Basically what am trying to accomplish is to restrict writing directly to these properties on the code side but i want Entity framework to be able to write to this properties.I want to expose the setter of these properties through a method whose sole purpose is to write values to it (ie: after some processing of course).
Your approach will work. I have used this pattern heavily. Entity Framework uses reflection to materialize your data into objects. Since reflection will work happily even if your members are private, the pattern works well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With