mrahhal / Migrator.EF6

.NET Core CLI tool to enable EF6 migrations in an Asp.Net Core app.
MIT License
82 stars 15 forks source link

Don't locate DbContexts and DbMigrationsConfigurations that cannot be constructed #25

Closed nphmuller closed 8 years ago

nphmuller commented 8 years ago

When an abstract (or generic) base class is made for either types, they might be used, instead of the implementation.

Example: I have an abstract class DbContextBase and a class MyApplicationContext : DbContextBase. Migrator.EF6 would incorrectly detect DbContextBase as the single true DbContext, instead of MyApplicationContext.

The constraint I've used are taken from the EF source code

mrahhal commented 8 years ago

And @nphmuller, for your info, EF6 is now maintained at GitHub instead of codeplex! Here: aspnet/EntityFramework6.

nphmuller commented 8 years ago

Thanks for the link! I moved the duplicate type checking to an extension method. Let me know what you think!

Edit: Ah, I misread your suggestion. If you think a method like GetConstructablesOfType() is better, I'll rewrite it.

mrahhal commented 8 years ago

Looks great. But I think you used spaces in Executor.cs and in TypeExtensions.cs (I'm using tabs). Please turn them to tabs and I'll merge (ctrl+r ctrl+w will let you see whitespace). Also, I recommend using this extension for visual studio so that you don't have to switch between spaces/tabs if the project you're contributing to has different set of conventions: editorconfig.

nphmuller commented 8 years ago

Should be all tabs now ;) I'll take a look at the extension. Sounds really handy.

mrahhal commented 8 years ago

Thanks a lot!