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/Dapper converters and clean architecture #111

Open
modabas opened this issue Sep 11, 2023 · 2 comments · May be fixed by #126
Open

EF Core/Dapper converters and clean architecture #111

modabas opened this issue Sep 11, 2023 · 2 comments · May be fixed by #126

Comments

@modabas
Copy link

modabas commented Sep 11, 2023

First of all, thanks for this awesome library, great work. Reduces boiler plate code required for strongly typed ids to near zero.

Unfortunately, i have come across a problem integrating it to an existing project designed with clean architecture. Using eShopOnWeb project as reference, general solution structure when using EF Core (or any ORM) would be:
Application Core project => db entities as poco, without any EF Core specific decoration
Infrastructure project => db context and db entity type configurations with fluent api.

However, as strongly typed id partial structs are defined along with db entities in Application Core project, StronglyTypedId attribute generates converters in that project which makes Application Core project dependent on Entity Framework Core (or Dapper if dapper converter is generated)

Is there a way to generate converters seperately, similar to fluent api decouples entity declaration and configuration.

Regards,

@ardalis
Copy link

ardalis commented Nov 10, 2023

I just ran into this same thing playing with this. Is there a way to have the converts generate in a separate project from the definition of the id type?

@andrewlock
Copy link
Owner

There isn't currently a way to make this work, it requires a bit of work. That said, I'm working on a fundamental redesign of the library in #117, and I think that flexibility will make it easy to add a way to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants