msawczyn / EFDesigner2022

Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
MIT License
119 stars 21 forks source link

Support for Identity Model Customization #31

Closed Mattnificent closed 1 year ago

Mattnificent commented 2 years ago

As described here:

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model

Not sure if this is possible - I tried this a few weeks ago, and just reverted everything back because I got caught in a snag.

I was able to add the attributes to my custom IdentityUser class, and context (fully qualified class names, since I don't see a way to add "using" statements to the generated context/model files)

The snag I ran into was that I couldn't specify the Primary Key for my inherited IdentityUser class in the EFDesign surface. Maybe there's a way to monkeywrench this thing to work in the Fluent API of the custom context partial class?

Would be super cool!

msawczyn commented 2 years ago

Duplicates https://github.com/msawczyn/EFDesigner2022/issues/38

It's not trivial, unfortunately. The approach I think is best (and I've worked off and on for quite some time now) is to start with a customized designer that pre-creates the necessary classes. There are a ton of things that, because of how the model integrates into Identity, have to be immutable when they would normally be editable -- but only for those classes. The complexity snowballs pretty quickly.

I haven't given up on getting this in, though. It would be a very popular addition. The overriding principles of code safety, simplicity of use and creating a pit of success drive the design, though.

msawczyn commented 1 year ago

Closing as duplicate of #38