IdentityServer / IdentityServer3.EntityFramework

EntityFramework persistence layer for IdentityServer3
Apache License 2.0
68 stars 97 forks source link

Providing Standard Scopes for IdSrv3 EF: EF Seed Method file location #127

Closed mhsimkin closed 7 years ago

mhsimkin commented 7 years ago

I’m reviewing the documentation located here: https://identityserver.github.io/Documentation/docsv2/ef/migrations.html .

It mentions a seed method in the file ScopeConfiguration/Configuration.cs. Where is that file located? I can’t seem to find it in the https://github.com/IdentityServer/IdentityServer3.EntityFramework code base.

Thank you for your help.

-marc

mhsimkin commented 7 years ago

This ticket: dd helper to init DB for standard scopes #25 https://github.com/IdentityServer/IdentityServer3.EntityFramework/issues/25

States that this functionality was moved to the admin code base. I searched there as well, I could not find the file.

brockallen commented 7 years ago

Seed is a method generated from EF migrations. It will be in whatever file you named you migrations. Here's ours from the sample: https://github.com/IdentityServer/IdentityServer3.Samples/blob/master/source/EntityFramework/SelfHost/Migrations/ScopeConfiguration/Configuration.cs#L16

mhsimkin commented 7 years ago

To see if I understand your point, I need to enable migrations. That process will then generate a file that contains a seed method (Migrations/ScopeConfiguration/Configurations.cs). I would need to implement the contents of that method, as per the documentation.

Also, if you don't want to enable migrations you can derive a class from System.Data.Entity.DropCreateDatabaseAlways and then override the Seed method there to populate the db.

brockallen commented 7 years ago

If you don't use migrations, then you have to come up with your own approach to seeding the DB.

mhsimkin commented 7 years ago

Thank you.