Skip to content

Project Initialization

Orbis Alonzo Gutierrez edited this page Aug 23, 2023 · 1 revision

Project Initialization

To initialize the project, there are 2 things to consider. First, if you're going to implement the BaseRepository or the MapRepository.

  • If you're going to use the BaseRepository without Identity or any helper,extensions etc. congratulations, you don't need to configure anything.
  • If you're going to use the BaseRepository with Identity.
// - User - IdentityUser
// - ApplicationIdentityDbContext - FoundationKitIdentityDbContext
builder.Services.AddFoundationKitIdentity<User, ApplicationIdentityDbContext>();
  • If you want to use MapRepository you need to add this code to program.cs file:
//this configuration is necessary if you want use IMapRepository with IdentityDbContext
// - Assembly.GetExecutingAssembly() - Assembly for AutoMapper profiles
// - User - IdentityUser
// - ApplicationIdentityDbContext - FoundationKitIdentityDbContext
builder.Services.AddFoundationKitIdentityWithMapper<User, ApplicationIdentityDbContext>(Assembly.GetExecutingAssembly());

//this configuration is necessary if you want use IMapRepository without IdentityDbContext
builder.Services.AddFoundationKit(Assembly.GetExecutingAssembly());

Finish you're ready for usage the library.

Clone this wiki locally