In Starup file
services.AddScoped<IUserResponsitory , UserResponsitory>();
services.AddSingleton<IAuthService>(service=>new AuthServiceImpl(
service.GetService<IUserResponsitory>(),service.GetService<IConfiguration>()));
In AuthServiceImpl file:
private IUserResponsitory m_userResponsitory;
private IConfiguration m_config;
public AuthServiceImpl(IUserResponsitory userResponsitory, IConfiguration config)
{
m_config = config;
m_userResponsitory = userResponsitory;
}
In the UserResponsitory file.
public class UserResponsitory : Responsitory<Users>,IUserResponsitory
{
private DbSet<Users> userEntity;
public UserResponsitory(MyDBContext context) : base(context)
{
userEntity = context.Set<Users>();
}
}
Some of the help: help1
Can you help me.Please!