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

SmartEnum.EFCore + SmartEnum.EFCore.UnitTests #53

Closed
wants to merge 7 commits into from

Conversation

mjuen
Copy link
Contributor

@mjuen mjuen commented Jun 22, 2019

Let’s face it. Configuring a huge amount of properties with special requirements in Entity Framework Core is time consuming, sometimes error prone, and in general annoying. If you want to use SmartEnum in this environment, you have to deal exactly with above-mentioned problems every time you are using the enum in an entity. This PR aims to eliminate the hassle and provide a convenient way for configuring all SmartEnums at once with one single line of code. It adds the new project SmartEnum.EFCore together with SmartEnum.EFCore.UnitTests.

Just use

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    ...
    
    modelBuilder.ConfigureSmartEnum();
}

at the end of the OnModelCreating method and you are good to go.

Take a look at it and tell me what you think :)

mjuen added 2 commits June 22, 2019 18:41
The additional package makes it possible to configure all SmartEnums for Entity Framework Core with one single line of code.
@trevor-hackett
Copy link
Contributor

This is very cool!

My only suggestion is that you update the README to include your sample code and how to install the package. Assuming that this would be it's own package (which it should be)

@ardalis
Copy link
Owner

ardalis commented Aug 9, 2019

This looks great there's only one thing I'd change before merging which is pretty simple. Can we not put SqlLite and Migrations and EF into the UnitTests project, since these all are external dependencies, and instead create a new IntegrationTests project side-by-side with UnitTests and move those tests and their dependencies there? Thanks!

@ardalis
Copy link
Owner

ardalis commented Jan 3, 2020

@mjuen do you have time to make the updates I asked for?

@ardalis
Copy link
Owner

ardalis commented May 7, 2020

Ok, can someone help get this over the finish line?

@mjuen
Copy link
Contributor Author

mjuen commented May 7, 2020

@mjuen do you have time to make the updates I asked for?

Sorry, I'm busy at the moment, but feel free to adjust everything to your needs.

@rsunde
Copy link

rsunde commented Dec 4, 2020

Just got stuck on an issue that this PR fixes, its a shame 18 months later its not done yet...

@hanslai
Copy link

hanslai commented Dec 18, 2020

does SmartEnum.EFCore make it into release? Couldn't find it in Nuget.

@ardalis
Copy link
Owner

ardalis commented Jun 4, 2021

Someone could please resolve conflicts and update this to use the current code, and we could merge it in. Otherwise in a month or two I will close this.

@Yaevh
Copy link
Contributor

Yaevh commented Jun 5, 2021

sorry for the mess regarding closing/reopening pull requests, I got a little confused about how to submit a pull request to another pull request. @ardalis, could you please take a look at #142 and tell if this is what you had in mind re #53 (comment)?

ardalis added a commit that referenced this pull request Jul 8, 2021
* Added SmartEnum.EFCore + SmartEnum.EFCore.UnitTests

The additional package makes it possible to configure all SmartEnums for Entity Framework Core with one single line of code.

* Changed folder names to match existing folder structure, deleted empty unit test project

* Updated README to include information about SmartEnum.EFCore

* implementing suggestions from #53 (comment)

Co-authored-by: Marcel Juen <marcel.juen@raincoat.systems>
Co-authored-by: Steve Smith <steve@kentsmiths.com>
@mjuen
Copy link
Contributor Author

mjuen commented Jul 20, 2021

Implemented by @Yaevh via #142

@mjuen mjuen closed this Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants