i using linqkit build query using dynamically generated filters.
that query fetches quite large object graph database perform calculations , other modifications data. long don't use includes in query, doesn't take long main entity need database. but, unfortunately, i need many of it's related entities perform needed calculations.
each time adding include, translates new nested subquery in sql. have 8 or 9 inlcudes translates a lot of nested subqueries. queries takes forever return data.
i these nested subqueries disappear sql, it's kinda tough shape sql way want using linqkit application side.
i thought that, specific case, idea write stored procedure way want sql be, , call entity framework.
my problem don't know how object graph on application side using stored procedure. can make ef generate complextype include data in single "entity", code doing calculation awaits specific entity object graph (the main entity , it's related entities) code has no idea complextype is. don't want have rewrite calculation engine use complextype. can map result single entity, that entity returned. want related entities returned too.
looks i'm caught between rock , crazy place.
can suggest ?
we had similar problems too. end building sql views, , query against views instead. think it's idea cqrs pattern, basically, separate read model write model.
Comments
Post a Comment