You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey so I'm currently doing a research project on Implementing HL7 Fhir http://hl7.org/fhir
And even trying to just implement Observations http://hl7.org/fhir/observation.html
Gives you a number of tables if you choose to model the tables correctly. (Not as just one huge Resource Table)
EF Core has actually been quite capable in taking the models and generating a sound Database, and inserting the data correctly, however, trying to retrieve the data has been problematic.
This is due to the requirement to explicitly declare the includes. HL7 FHIR has a strict policy on what must be included and when. And with attempting to include everything is leaving me having to generate a large amount of boilerplate that wasn't necessary in old EF.
I've naively solved this by writing an extension method
publicstaticIQueryable<T>IncludeAll<T>(thisIQueryable<T>queryable,DbContextcontext)whereT:class{foreach(var property in context.Model.FindEntityType(typeof(T)).GetNavigations())queryable= queryable.Include(property.Name);returnqueryable;}
When I tried do the same with ThenInclude, there is no method for ThenInclude that takes a string.
The goal was to try and write a recursive function controlled by a depth constraint, so I could implement an IncludeAll Extension
proposal
Add a string overload of ThenInclude that allows us to write our own function that easily uses reflection to generate the Includes/ThenIncludes.
Discussions
I know that this isn't the best solution performance wise, but as it stands the EF Core api doesn't give me a easy way to say Include all these things AND their childs and in fhir that depth can be rather unbounded. So if anyone has workaround, I'm all ears.
What would be an awesome solution would be able to say,
Include this and all of it's childs to some depth
Observation.Include(x => x.Code,true)
Anyway I digress.
The text was updated successfully, but these errors were encountered:
Presumably this "wasn't necessary in old EF" because of lazy loading, which is being tracked as #3797. Also, it seems what you are describing could be a good use of aggregates (#1985) or at least rule-based eager loading (#2953).
Context
Hey so I'm currently doing a research project on Implementing HL7 Fhir http://hl7.org/fhir
And even trying to just implement Observations http://hl7.org/fhir/observation.html
Gives you a number of tables if you choose to model the tables correctly. (Not as just one huge Resource Table)
EF Core has actually been quite capable in taking the models and generating a sound Database, and inserting the data correctly, however, trying to retrieve the data has been problematic.
This is due to the requirement to explicitly declare the includes. HL7 FHIR has a strict policy on what must be included and when. And with attempting to include everything is leaving me having to generate a large amount of boilerplate that wasn't necessary in old EF.
I've naively solved this by writing an extension method
When I tried do the same with ThenInclude, there is no method for ThenInclude that takes a string.
The goal was to try and write a recursive function controlled by a depth constraint, so I could implement an IncludeAll Extension
proposal
Add a string overload of ThenInclude that allows us to write our own function that easily uses reflection to generate the Includes/ThenIncludes.
Discussions
I know that this isn't the best solution performance wise, but as it stands the EF Core api doesn't give me a easy way to say Include all these things AND their childs and in fhir that depth can be rather unbounded. So if anyone has workaround, I'm all ears.
What would be an awesome solution would be able to say,
Include this and all of it's childs to some depth
Anyway I digress.
The text was updated successfully, but these errors were encountered: