0

I have been tasked with converting a spreadsheet in excel to an editable grid in MVC.

I can create the view just fine (takes about 14 seconds to run), but since I am using a temporary table to build the view Entity framework throws a fit. (Sorry I forget the actual error I received)

I am using a temporary table because each column's value depends on the previous column's value, for instance...

ColF = foo(ColA, ColB)
ColG = foo2(ColA,ColF)
ColM = foo3(ColG,ColA,ColC)

If I did it without a temporary table I would end up with something like this...

ColM = foo3(foo2(ColA,foo(ColA, ColB)),ColA,ColC)

This gets very messy and hard to understand so editing the query in the future will be almost impossible. Also, keep in mind that I have almost 50 columns, all building off each other.

Is there a way I can use a materialized view with a temporary table and MVC's Entity Framework, or something else? If not, it takes forever to load.

TruthOf42
  • 2,017
  • 4
  • 23
  • 38
  • How do you plan to store the edited grid? Materializing a representation of the data is only half of the issue. – Eric J. Nov 23 '15 at 22:26
  • They would only be able to edit the columns that feed into the formulas which are indeed saved into normal tables – TruthOf42 Nov 24 '15 at 02:30

1 Answers1

0

If you want to perform this calculation on the database server, you can build and emit that temporary table out through a stored procedure.

EF can build an entity from that: https://msdn.microsoft.com/en-us/data/gg699321.aspx

edit: And here's a stack overflow link about it: using stored procedure in entity framework

Community
  • 1
  • 1