HMIS.Base.Repository 1.0.3

HMIS.Base.Repository

A Package for Base Repos for the HMIS sln that will be used in all the Modules.


Installation

Add Internal NuGet Package Source with the next steps:

  • Open Visual Studio.
  • Go to Tools > Options.
  • Select NuGet Package Manager > Package Sources.
  • Click the + button to add a new package source.
  • Set the Name to e.g. HMIS and the Source to https://baget.ahbsdev.com/v3/index.json.
  • After that, click OK to save the changes.
  • Then, you can install the package via the .NET CLI:
dotnet add package HMIS.Base.Repository --source https://baget.ahbsdev.com/v3/index.json

Or via the NuGet Package Manager:

  • Open the NuGet Package Manager in Visual Studio.
  • Package Manager Console:
    Install-Package HMIS.Base.Repository -Source https://baget.ahbsdev.com/v3/index.json
    

Or via the NuGet Package Manager UI:

  • Open the NuGet Package Manager in Visual Studio.
  • Select the HMIS package source from the dropdown.
  • Search for HMIS.Base.Repository.
  • Click Install to add the package to your project.

Usage Example

Here is a simple example of how to use the HMIS.Base.Repository package in your project:

Module_UnitOfWork

using HMIS.Base.Repository.UnitOfWorks;

Code Before Example...

public interface IModule_UnitOfWork : IUnitOfWork
{
}

Code After Example...

public interface IModule_UnitOfWork : IUnitOfWork<Module_Entities>
{
}

Module_UnitOfWork

using HMIS.Base.Repository.Context;
using HMIS.Base.Repository.UnitOfWorks;
using HMIS.Base.Models.User;

Code Before Example...

public class Module_UnitOfWork : UnitOfWork, IModule_UnitOfWork
{
    public readonly Module_Entities _dbContext;
    private readonly IUserInfo _userInfo;

    public Module_UnitOfWork(IUserInfo userInfo, Module_Entities dbContext)
        : base(userInfo, dbContext)
    {
        _dbContext = dbContext;
        _userInfo = userInfo;
    }
}

Code After Example...

public class Module_UnitOfWork : UnitOfWork<Module_Entities>, IModule_UnitOfWork
{
    public readonly IMainDbContext<Module_Entities> _dbContext;
    private readonly IUserInfo _userInfo;

    public Module_UnitOfWork(IUserInfo userInfo, IMainDbContext<Module_Entities> dbContext)
        : base(userInfo, dbContext)
    {
        _dbContext = dbContext;
        _userInfo = userInfo;
    }
}

Module_EFRepository

using HMIS.Base.Repository.Context;
using HMIS.Base.Repository.Repositories;
using HMIS.Base.Repository.Repositories.Interfaces;

Code Before Example...

public abstract class Module_EFRepository<T> : Repository<T, Module_Entities>, IRepository<T, Module_Entities>
     where T : class
{
    protected readonly IModule_UnitOfWork _unitOfWork;

    //  readonly protected IUserInfo _UserInfo;

    public Module_EFRepository(IModule_UnitOfWork unitOfWork)
        : base((Base.Repository.UnitOfWorks.IUnitOfWork)unitOfWork)
    {
        _unitOfWork = unitOfWork;


    }

}

Code After Example...

public abstract class Module_EFRepository<T> : Repository<T, Module_Entities>, IRepository<T, Module_Entities>
    where T : class
{
    public Module_EFRepository(IMainDbContext<Module_Entities> mainDbContext) : base(mainDbContext)
    {
    }
}

Modeule_IRepositories

using HMIS.Base.Repository.Repositories.Interfaces;

Code Before Example...

public interface IModuleRepository : IRepository<ModuleModel, **int**>

Code After Example...

public interface IModuleRepository : IRepository<ModuleModel, **Module_Entities**>

Module_Repositories

Code Before Example...

public class ModuleRepository : Module_EFRepository<ModuleModel, **long**>, IModuleRepository
{
    public ModuleRepository(**IModule_UnitOfWork unitOfWork**)
        : base(**unitOfWork**)
    {

    }
    public IQueryable<Ex> GetAllSpecialities()
    {
        return this.**GetAll**(S => S.IsDeleted != true);
    }
}

Code After Example...

public class ModuleRepository : Module_EFRepository<ModuleModel>, IModuleRepositoryRepository
{
    public ModuleRepository(**IMainDbContext<Module_Entities> mainDbContext**)
        : base(**mainDbContext**)
    {

    }
    public IQueryable<Ex> GetAllSpecialities()
    {
        return this.**Get**(S => S.IsDeleted != true);
    }
}

Notice the changes of GetAll Method Name Changed to be Get.

Program.cs

builder.Services.AddDbContext<Module_Entities>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("Module_Entities")));

builder.Services.RegisterBaseRepository<Module_Entities>(builder.Configuration);

Showing the top 20 packages that depend on HMIS.Base.Repository.

Packages Downloads
HMIS.Base.SL.DAL
A Library for Base Repos for the HMIS sln that will be used in all the Modules.
45
HMIS.Base.Contract
A Library for Base Repos for the HMIS sln that will be used in all the Modules.
42
HMIS.Base.SL.Model
A Library for Base Repos for the HMIS sln that will be used in all the Modules.
42
HMIS.Base.ServiceLocator
A Library for Service Locator for the HMIS sln that will be used in all the Modules.
39
HMIS.Base.SL.Model
A Library for Base Repos for the HMIS sln that will be used in all the Modules.
26
HMIS.Base.Contract
A Library for Base Repos for the HMIS sln that will be used in all the Modules.
24
HMIS.Base.ServiceLocator
A Library for Service Locator for the HMIS sln that will be used in all the Modules.
23
HMIS.Base.ServiceLocator
A Library for Service Locator for the HMIS sln that will be used in all the Modules.
21
HMIS.Base.ServiceLocator
A Library for Service Locator for the HMIS sln that will be used in all the Modules.
17
HMIS.Base.ServiceLocator
A Library for Service Locator for the HMIS sln that will be used in all the Modules.
14

Version Downloads Last updated
1.0.3 27 11/18/2025
1.0.2 24 11/12/2025
1.0.1 37 11/09/2025
1.0.0 27 10/26/2025