在指定了所有固定参数后,必须出现命名参数规范(named argument specifications must appear after all fixed arguments gave been specified)
我的代码行有问题:
return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), Page: 15, p => p.Id == 1, u => u.RoleName != "null"));此行会抛出此消息的异常:
在指定了所有固定参数后,必须出现命名参数规范
这是方法声明:
public virtual IEnumerable<TEntity> Get( Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, int? Page=0, params Expression<Func<TEntity, bool>>[] filter)如何修改我的参数列表以消除此错误?
I have problems with this line of my code:
return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), Page: 15, p => p.Id == 1, u => u.RoleName != "null"));this line throws an exception with this message:
named argument specifications must appear after all fixed arguments gave been specified
And here is the method declaration:
public virtual IEnumerable<TEntity> Get( Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, int? Page=0, params Expression<Func<TEntity, bool>>[] filter)How can I modify my argument list to get rid of this error?
最满意答案
您应该能够简单地不提供页面参数的名称:
return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), 15, p => p.Id == 1, u => u.RoleName != "null"));You should be able to simply not provide the name of the page argument:
return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), 15, p => p.Id == 1, u => u.RoleName != "null"));更多推荐
发布评论