EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Document EF Core architecture and internal technical details

Open ajcvickers opened this issue 5 years ago • 12 comments

To make it easier for contributors and provider authors to understand the code.

Please comment on this issue with internal areas you would like to see documented.

Working list of possible topics to document. This list will evolve in the issue as we make progress. Not everything in the list will necessarily make it to documentation--it will depend on value, resources, etc. as usual.

  • [ ] Internal service provider
  • [ ] Singleton options
  • [ ] Dependency objects
  • [ ] DbContext initialization
  • [ ] Context pooling
  • [ ] Change tracking
  • [ ] SaveChanges/update pipeline
  • [ ] Everything query!
  • [ ] Proxies
  • [ ] Lazy-loading
  • [ ] Constructor injection
  • [x] Everything model building! (https://github.com/aspnet/EntityFramework.Docs/issues/779)
  • [x] Model building conventions (https://github.com/aspnet/EntityFramework.Docs/issues/1937)
  • [ ] Shadow properties
  • [ ] Logging
  • [ ] Interceptors
  • [ ] Diagnostics
  • [ ] External model building
  • [ ] Metadata interfaces (mutable, etc.)
  • [ ] Weak entity types
  • [ ] Owned entity types
  • [ ] Relational mapping (https://github.com/dotnet/efcore/issues/12846)
  • [ ] Pubternal types
  • [ ] Parameter generation and facets

ajcvickers avatar Nov 14 '19 20:11 ajcvickers

@aspnet/efteam Please add anything with internals that it might be worth documenting. I would rather have too many things on this list and then trim it, so treat this as brainstorming list--no bad ideas!

ajcvickers avatar Jan 30 '20 19:01 ajcvickers

  • [x] Plugins (type mapping, translators, etc.)
  • [ ] Migrations
    • [ ] Diffing (especially how provider model attributes become migration operation attributes)
    • [ ] DDL generation
  • [ ] Scaffolding/Reverse Engineering
    • [ ] How design-time services are discovered
    • [ ] Reading database metadata
    • [ ] Provider code hooks (UseMyProvider, literals, etc.)
  • [ ] How the tools work (dotnet-ef and the PMC cmdlets)

bricelam avatar Jan 30 '20 19:01 bricelam

Please consider these:

  1. How to get current Table/Column/... information from DbContext. Like this

  2. How to call the scaffold/reverse tool by code (Not CLI). Like this

HamedFathi avatar Jan 30 '20 21:01 HamedFathi

I'm not sure if this counts as "internals" but after EF Core 3.0, satisfying the query compiler to run the code on the server-side has been really time consuming. I don't argue the benefits of the change but it's not a straightforward process. I wish there was a documentation comparing client-side running queries with equivalent server-side running ones.

ssg avatar Jan 31 '20 02:01 ssg

It would be great to see how the major patterns were implemented (or not) in EF - identity map, data mapper, repository, unit-of-work, lazy loading, association table mapping, metadata mapping, query object etc..

tudort-iquest avatar Jan 31 '20 05:01 tudort-iquest

I in general agree with @ssg , but I want to see how do you generate SQL from different kind of queries. All releases of EF Core starting from betas has changes which require rewriting of the queries to satisfy new version. Expecially many issues I see withing queries which involve GROUP BY or other aggregate functions. If you explain how do you generate SQL using your internal model, it would be easier to write LINQ which will conform to your expected set of queries.

kant2002 avatar Jan 31 '20 16:01 kant2002

Also what is TPT, TPH, TPC and PMC ? It is not very clear.

kant2002 avatar Jan 31 '20 16:01 kant2002

Also what is TPT, TPH, TPC and PMC ? It is not very clear.

table per type, table per hierarchy, table per concrete class - most O/RMs support these inheritance mapping strategies, maybe under different names..

tudort-iquest avatar Jan 31 '20 16:01 tudort-iquest

Thanks, I get it. I decipher TPT and PMC myself, but other abbreviations not very often I see in MS documentation (or maybe communication better to say). So that's why I ask. Maybe I'm not alone in that.

kant2002 avatar Jan 31 '20 16:01 kant2002

  • change tracking
  • interceptors
  • save changes
  • context pooling , Please!

explorer14 avatar Jan 31 '20 17:01 explorer14

Awesome - let's add these to the provider writer "docs": #4424.

roji avatar Jul 22 '23 12:07 roji