<cite>hikalkan: </cite> Using IocManager .Instance.Resolve is a good way. But I suggest ResolveAsDisposable method since you should always release a class if you resolved it manually.
Another way: You can register filter attribute to dependency injection and register your filter like that: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Api/WebApi/AbpWebApiModule.cs#L82">https://github.com/aspnetboilerplate/as ... ule.cs#L82</a>
Thanks a lot! Actually,I found some other questions in using abp's Context.set<TEntity>().Methods Like AddRange and so on . Sometimes,yes,sometimes, there are no reactions.No successful ,no fail tips even thouth I used 'Try Catch' to grab the ex. And sometimes it works. There is my code. Could I get help from you? public async Task< OperationResult> ImportSchoolList(List<AbpSchool> schoolList) { var operatioResult = new OperationResult();
try
{
Context.Set<AbpSchool>().AddRange(schoolList);
operatioResult.AppendData = await Context.SaveChangesAsync();
}
catch (Exception ex)
{
LoggerHelper.Error(ex.Message, ex);
}
return operatioResult;
}
<cite>hikalkan: </cite> Because, AddRange is defined in DbSet, not in IDbSet. You've two options:
- Just use Table as shown below:
var data = Table.AddRange(tasks);
- Use DbSet instead of IDbSet in your DbContext properties.
Thanks a lot!