When I create an repository like 'Repository', I can't use those methods such as 'AddRange' or others. Here is my code
public class TaskRepository: BrightEyesProjectRepositoryBase<Task,long>, ITaskRepository { public TaskRepository(IDbContextProvider<BrightEyesProjectDbContext> dbContextProvider) : base(dbContextProvider) { }
public OperationResult InsertTaskList(List<Task> tasks)
{
var operationResult = new OperationResult(OperationResultType.Success);
**var data = Context.Tasks.AddRange(tasks);**// there is a mistake about 'AddRange'.IDbSet<Task> Not included in the definition of 'AddRange'.
throw new NotImplementedException();
}
}
Could you fix it, thank you...
3 Answer(s)
-
0
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.
-
0
<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!
-
0
Hi @IvanoFFWiff,
This question is not related to this topic and ABP framework. You can search web for it, there are many answers.
Have a nice day.