As a decorate Expression?

0 like 0 dislike
8 views
Asp.Net MVC, MS Sql, Entity Framework

Is there a query that aggregates a dozen large tables. It looks like this:

_db.Table.Where(t=>...) .Select(t=>new Model{ Field1 = t.SomeTable.Field Field2 = t.SomeTable2.Field ...etc, about 30 fields...}).ToList();


The work is still not particularly fast, the load on the database creates is palpable.

The question is:
It often happens that some fields are not needed, and accordingly some aggregated tables are not needed, and therefore need to make a "base" Expression and decorate it need more fields.
Just to describe all the possible options is theoretically possible, but the variability is large.
Is there any way to decorate Expression? Or are there other ideas how to solve this problem?
asked by | 8 views

2 Answers

0 like 0 dislike
you need to create a stored procedure
answered by
0 like 0 dislike
Similar problems in work arise regularly. Build the SQL query text manually, without any Linq to SQL.
Depending on current needs, include in the text of the SQL query the tables, conditions, groups, etc. that are needed.
answered by

Related questions

0 like 0 dislike
2 answers
asked Aug 17 by byte916
0 like 0 dislike
2 answers
asked Jul 1 by byte916
0 like 0 dislike
2 answers
asked Jul 3 by byte916
0 like 0 dislike
2 answers
asked Jul 13 by byte916
110,581 questions
257,150 answers
0 comments
476 users