开发者

Calculations with Entity Framework

I've got a credit cards entity which includes interest rates and interest free period as properties. I want my users to provide their credit card balance and how quickly they pay it off, and to return a开发者_如何学Go table of the credit cards with a field for how much the users would pay over 2 years with that card, and it should be sorted by that calculate field.

Does anyone have any advice for how to accomplish this with the entity framework so that I can bind the results to a databound control? Thanks in advance.


This isn't something you would do in the Entity Framework per se. The Entity Framework is about the persistance and retreival of your data from an underlying data store, not about the logic you apply to that data.

What I would recommend is that you either have a stored procedure that saves the data and then re-queries the data, performing the calculations necessary after you re-fetch it in the sproc, or fetch the data in your business layer and then perform the calculations on the data returned.

Either way, you can go with the Entity Framework to handle the call to persist/retrieve the data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜