I try to make work a code from aspnetboilerplate.
There is a call to WindsorContainer
class function
public void Register(Type type, Type impl, DependencyLifeStyle lifeStyle = DependencyLifeStyle.Singleton)
which looks like this:
iocManager.Register(
typeof(IRepository<,>).MakeGenericType(entityType, primaryKeyType),
typeof(EfRepositoryBase<,,>).MakeGenericType(dbContextType, entityType, primaryKeyType),
DependencyLifeStyle.Transient
);
The resuting types are:
[System.RuntimeType] = {Name = "IRepository`2" FullName = "Abp.Domain.Repositories.IRepository`2"}
and
base = {Name = "EfRepositoryBase`3" FullName = null}
We can see that the instantiated by MakeGenericType()
concrete type's FullName
is null
.
The class EfRepositoryBase3
looks like this:
public class EfRepositoryBase<TDbContext, TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>
where TDbContext : DbContext
{
... CRUD methods...
}
Why the FullName
of it is null
and how the issue could be overcome?
FullName can return null in some cases
You can get a non null name by using the
GetGenericTypeDefinition
method.