Q:

IdentityServer4.Models vs IdentityServer4.EntityFramework.Entities

I like to use the EntityFramework for persistence of the IndentityServer4 configuration data. But I was wondering why the same model Classes are duplicated in Model / Entities? Are both models always kept in sync? If I use the Entities, can I still include the Models project to use some convenient const and enum classes which are available in Models but not in Entities? Or is it better when using Entities to not include the Models library to prevent confusion.
Please advice.

A:

The Models are duplicated in the IdentityServer4.EntityFramework library so that the models can be mapped to entities that make sense to Entity Framework (see the many lists of strings that need to be turned into entities so that they can be stored in separate tables). These entities are kept in sync by the IdentityServer team and the community.
There are mapper extensions for both types to convert them into one another: ToModel() and ToEntity().
Always use the Models unless you are communicating directly with the database.

