jqGrid & ASP.NET 4 MVC: How to make search implementation on a DBContext repository and 'calculated' properties?

前端 未结 2 512
借酒劲吻你
借酒劲吻你 2021-01-17 04:57

I\'m trying to implement jqgrid search on MVC, following the interesting answer by @Oleg, regarding the question: ASP.NET MVC 2.0 Implementation of searching in jqgrid.

2条回答
  •  鱼传尺愫
    2021-01-17 05:25

    The best working solution to my problem has been resolved following the precious hints of Mr @Oleg: I moved the calculated properties into SQL Server, creating Computed Columns for each property. Now it works fine and it is really fast!

    I lost more time trying to get working the calculated properties with ObjectSet, than create new computed columns directly in the db! As rightly pointed by Oleg, simple things are always the best!

    Just another hint, for who's using EF Codefirst: if you want to use computed properties, you must DROP COLUMNS after db creation and putting [DatabaseGenerated(DatabaseGeneratedOption.Computed)] attribute above property, as specified in here too.

    Thank you very much Oleg! I hope this solution may help other people!

提交回复
热议问题