Issue
This Content is from Stack Overflow. Question asked by user1536978
I am trying to register repositories in a separate module called freeswitch via ABP Framework.
Interface is IFSExtensionRepository
context.Services.AddAbpDbContext<FreeswitchDBContext>(options =>
{
options.AddRepository<FSExtension, EfCoreExtensionRepository>();
});
Freeswitch DB Context
[ConnectionStringName(FreeswitchDbProperties.ConnectionStringName)]
public class FreeswitchDbContext : AbpDbContext<FreeswitchDbContext>, IFreeswitchDbContext
{
/* Add DbSet for each Aggregate Root here. Example:
* public DbSet<Question> Questions { get; set; }
*/
public DbSet<FSExtension> Extension { get; set; }
public FreeswitchDbContext(DbContextOptions<FreeswitchDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureFreeswitch();
}
}
Repository
public class ExtensionRepositoryEf : EfCoreRepository<IFreeswitchDbContext, FSExtension, Guid>, IFSExtensionRepository
{
private readonly ICurrentTenant CurrentTenant;
public ExtensionRepositoryEf(IDbContextProvider<IFreeswitchDbContext> dbContextProvider, ICurrentTenant currentTenant) : base(dbContextProvider)
{
CurrentTenant = currentTenant;
}
public virtual async Task<FSExtension> FindByNameAsync(string extensionName, CancellationToken canceltoken = default)
{
return await (await GetDbSetAsync())
.OrderBy(t => t.Id)
.FirstOrDefaultAsync(t => t.ExtensionNumber.ToLower() == extensionName.ToLower() && t.TenantId == CurrentTenant.Id, GetCancellationToken(canceltoken));
}
}
The error I get while calling the class which is injecting IFSExtensionRepository is below
———- Exception Data ———-
ActivatorChain = Castle.Proxies.RinglurUserServiceProxy -> RinglurNet.Ringlur.RinglurUserManager -> Freeswitch.Service.ExtensionManager
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.