下面的代码在EF Core 2.2上正常工作,但在EF Core 3.0上不工作
var items = (from asset in Context.Assets
join assetCategory in Context.AssetCategories on asset.CategoryId equals assetCategory.Id
group assetCategory by assetCategory.Id into assetCategories
select new AssetCategorySummary
{
CategoryId = assetCategories.Key,
CategoryName = assetCategories.Select(p => p.CategoryName).FirstOrDefault(),
TotalAsset = assetCategories.Count()
}).ToListAsync();
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
由“ NavigationExpandingExpressionVisitor”处理LINQ表达式“ AsQueryable(Select(源:NavigationTreeExpression值:default(IGrouping)表达式:(未处理的参数:e),选择器:(p)=> p.CategoryName))”失败。这可能表示EF Core中存在错误或限制。有关更多详细信息,请参阅https://go.microsoft.com/fwlink/?linkid=2101433。
需要帮助
编辑:如下 解决
var items = Context.Assets.AsEnumerable().GroupBy(p => p.CategoryName).Select(p => new AssetCategorySummary
{
CategoryId = p.Select(r => r.CategoryId).FirstOrDefault(),
CategoryName = p.Select(r => r.CategoryName).FirstOrDefault(),
TotalAsset = p.Count()
}).ToList();
Run Code Online (Sandbox Code Playgroud)
但我认为这无效。
There are two page one is Edit page and the other is Main Detail page which is combined data of some entities In edit page : after edit done and I posted the data to API as below
public async Task<IActionResult> OnPostAsync(Guid id)
{
ManufacturerAuthorizedPerson.Id = id;
ManufacturerAuthorizedPerson.ManufacturerId = GetManufacturerId(id);
if (!ModelState.IsValid)
{
await OnGetAsync(id);
return Page();
}
HttpResponseMessage = await httpSystemApi.PutAsync("ManufacturerAuthorizedPersons", ManufacturerAuthorizedPerson);
if (HttpResponseMessage.IsSuccessStatusCode)
{
return RedirectToPage("../Detail", ManufacturerAuthorizedPerson.ManufacturerId);
}
else
{
await OnGetAsync(id);
return Page();
}
}
Run Code Online (Sandbox Code Playgroud)
The ID …
有什么方法可以将“HasQueryFilter”全局应用于我的所有实体?我不想一一添加模型构建器?
modelBuilder.Entity<Manufacturer>().HasQueryFilter(p => p.IsActive);
Run Code Online (Sandbox Code Playgroud) 是否可以将 opencv(使用 python)作为默认读取图像作为 RGB 的顺序?在 opencv 文档中 imread 方法以 BGR 的顺序返回图像,但在代码中 imread 方法以 RGB 顺序返回图像?我没有做任何转换过程。刚刚使用 imread 方法并显示在屏幕上。它在 Windows 图像查看器上显示。是否可以 ?
编辑 1: 我的代码如下。左侧 cv.imshow() 方法和另一个 plt.imshow() 方法。
cv2.imshow() 方法将图像显示为 RGB,plt 将其显示为 opencv 读取 (BGR) 图像。
image_file = 'image/512-2-1001-18-RGB.jpg'
# img = imp.get_image(image_file)
img = cv2.imread(image_file)
plt.imshow(img)
plt.show()
cv2.imshow('asd', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
编辑 2: 一些 opencv imshow 方法如何将图像显示为下面的 RGB 我附加了图像的第一个像素值,下一个图像是 photoshop 像素值
编辑 3: 下面只是读取图像和 imshow 和第二个图像是原始 RGB 图像。
在 imshow 方法图像看起来与原始图像相同后,这让我很困惑
按RGB顺序的原始图像。
我正在开发一个在asp.net core 2 razor页面上运行的项目.我需要一个解决方案来将部分视图或组件加载到RAZOR页面中,我也可以发送来对象(某些类模型或基本字符串).
这是我想加载局部视图的详细页面.使用此代码:
@{
await Html.RenderPartialAsync("Shared/Partial/DeleteModal", Model.DeleteModalModel);
}
Run Code Online (Sandbox Code Playgroud)
这是我内心的部分观点
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header bg-red">
<h4 class="modal-title" id="defaultModalLabel">D?KKAT KAYIT S?L?NECEKT?R !</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<input type="submit" asp-page-handler="Delete" class="btn bg-red m-t-15 waves-effect" value="Sil" data-toggle="modal" data-target="#deleteModal" />
<button type="button" class="btn bg-indigo m-t-15 waves-effect" data-dismiss="modal">@Html.DisplayNameFor(model => Model.ViewModel.Buttons.Close)</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
down是局部视图模型
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Q.Presentation.System.Razor.Pages.Shared.Partial
{
public class DeleteModalModel : PageModel
{
public string Message { get; set; } …
Run Code Online (Sandbox Code Playgroud)