我有这种阅读服务方法:
public IQueryable<Order> GetListQuery()
{
return this._orderRepository.Table;
}
我这样称呼这个方法:
var config = new MapperConfiguration(cfg => {
cfg.CreateMap<Order, ViewModelOrder_Order>();
});
List<ViewModelOrder_Order> orderList = this._orderReadService.GetListQuery()
.Where(m => m.UserId == user.Id)
.ProjectTo<ViewModelOrder_Order>(config)
.ToList();
当我运行此代码时,我将orderList作为null。我该如何修复此代码?感谢。
这是我的订单类:
public long Id { get; set; }
public string UserId { get; set; }
public string ProductId { get; set; }
public virtual ApplicationUser User { get; set; }
public virtual Product Product { get; set; }
答案 0 :(得分:1)
如果您的搜索结果有值,则可以更改
之类的映射#!/bin/bash
mysql -u root -password << EOF |
use runk_prd;
SELECT user_push_token FROM users WHERE user_push_token <> 'NULL'
EOF
while read user_push_token; do
echo "pushToken: $user_push_token"
done
并像
一样使用它var config = new MapperConfiguration(cfg => {
cfg.CreateMap<Order, ViewModelOrder_Order>();
});