Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Core Improvements #323

Open
11 of 19 tasks
Daniel-Svensson opened this issue Oct 21, 2021 · 0 comments
Open
11 of 19 tasks

EF Core Improvements #323

Daniel-Svensson opened this issue Oct 21, 2021 · 0 comments
Milestone

Comments

@Daniel-Svensson
Copy link
Member

Daniel-Svensson commented Oct 21, 2021

  • Create EFCore versions of relevant EF based projects
    • OpenRiaServices.Server.EntityFramework / OpenRiaServices.Server.EFCore
      make OpenRiaServices.EntityFramework
    • Only the DbContecxt related classes are relevant (DbDomainService and it's attribute), however some things are delegated to the original classes made for "LinqToEntities" (ObjectContext) so it is not as easy to just ignore everything related to ObjectContext since it might be used internally.
    • The public API surface should only contain a single DomainService type, attribute etc, since there is only "one way" to do EF core and not all the variants of EF6 (ObjectContext, POCO, DbContext with edmx, DbContext code first ..)
    • Give public types simple but descriptive names

Test

  • EFCore model for AdventureWorks and Northwind (similar to EFDbContextModels) projects
    • Ensure that we don't only use DataAanotations but use EF core "configuration" api to setup Keys etc.
  • OpenRiaServices.Common.DomainServices.Test
    • Add Adventureworks "catalog" service (should be able to copy from EF DbContexct)
    • Add "Northwind" service similar to "EFDbCtx_Northwind"
  • Ensure we have unit tests for the "DomainServiceDescription" (there seems to be existing tests in DomainServiceDescriptionTest.cs`). The code generation tests might cover most of the things we would cover here. (That the correct attributes are discovered/added based on EF core model)
  • Add functional E2E tests in Client
    • Find tests which uses NorthwindContext or adwentureworks and which have variants for different ORM's. `
    • UpdateTestswhich have several subclasses is one such instance. (withDbCtxUpdateTests andEFCFUpdateTests` as subclasses today),
    • is QueryTests also relevant ?
    • Look into the ProviderType enum and it's usage, we probable want a new value EFCore or similar.
  • Add code generation tests (OpenRiaServices.Tools.* test projects)
    store baselines in same place as others, assuming the EFCore version of the domainservices/models can be the same as the EF6 version the output of the code generation should be identitcal to that of EF6.
    - Identify code generation tests which EF uses Catalog_EFDbCtx.g.cs and similar tests such as Northwind_EF.g.cs/vb and make EFCOre versions of them
    They seems to exist in CodeGenDomainServices see TestCatalogEFClientProxies and TestNorthwindEFClientProxies

Documentation (before release)

  • Write a getting started guide for ef core (should cover installing the nuget and adding a domain service)
  • Update docs so it mentions ef core support

"Tooling" / Visual Studio

  • Adding support to VisualStudio integration and tooling to discover EFCore DbContext is not a top priority. It can preferably be done once everything else works fine.
  • Update related test such as BusinessLogicClass_Context_EFCoreDbContextTest (commented out) by building a similar thing as LinqToEntitiesDbContext but using EF Core's IModel since current LinqToEntitiesDbContext uses EF6 metadata model

Releasing

  • new nuget OpenRiaServices.Server.EFCore / EntityFrameworkCore
  • getting started documentation or update existing
  • look into adding support to tooling

Not supported / limited support

  • Support for owned entities (in EF 6 represented ComplexTypes), is limited/untested. Modifications may be required in EFCoreTypeDescriptor and unit tests similar to DomainServiceDescriptionTest.ComplexType_EFProviderTest added.
  • M2M should be supported but only using link entities. Further testing might be required. Especially the Adventure Works model should be extended to contain all its entities to being able to get the RoundtripOriginalAttributes in the generated code in Catalog_EFDbCtx.g.cs to match the EF6 version.

Future improvement

  • Investigate to use compiled models instead of activator in EFCoreTypeDescriptionContext.cs (requires newer version of EF Core)
@Daniel-Svensson Daniel-Svensson added this to the 6.0 milestone Oct 21, 2021
@Daniel-Svensson Daniel-Svensson changed the title EF Core Support Improve EF Core Support Apr 21, 2024
@Daniel-Svensson Daniel-Svensson changed the title Improve EF Core Support EF Core Improvements Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants