需要从自动填充下拉列表中删除新实体(需要帮助)
我想在以下方面寻求帮助.
我有一个名为ContentItem的实体 ,它包含一个类型说明符(从FK到ItemType表格),以及一个字符串名称.
I have an entity named ContentItem which contains a type specifier (FK to ItemType tabel) , and a name as string.
每个ContentItem都可以引用另一个ContentItem,因此我对其自身进行了0..1到n的关系.
Each ContentItem can have a reference to another ContentItem so I made a 0..1 to n relation to itself.
该模型显示在下图中第一张图片的顶部.
需要有一个业务规则,即ContentItem只能链接到另一种类型的ItemType.例如. ItemType 1至ItemType 2
There needs to be a business rule that a ContentItem can only be linked to ItemTypes of another type. E.g. ItemType 1 to ItemType 2.
因此,我首先进行了可编辑的网格屏幕编辑项目类型.
然后,我设计一个网格/详细信息屏幕,在该屏幕中,用户需要在下拉菜单中选择要链接的项目.屏幕上的项目称为linkeditem.
Then I design a grid / details screen where in a dropdown the user needs to select an item to be linked. the screen item is called linkeditem.
屏幕看起来像第二张图片,如下图所示.
The screen looks as the second image is the picture below.
为了让下拉列表仅显示链接的项目,我在查询中ContentItems表中的一个子项,将其命名为ItemsAvailableToLink并作为参数检索 屏幕中选定的ItemType.
In order to have the dropdown show only the linked Items I made a query as a child from ContentItems table, call it ItemsAvailableToLink and retrieves as parameter the selected ItemType in the screen.
在预处理查询"中,我将查询更改为以下内容:
In the Preprocess Query I change the query to the following:
partial void ItemsAvailableToLink_PreprocessQuery( ? ItemTypeId, ref 可查询 ContentItem
partial void ItemsAvailableToLink_PreprocessQuery(int? ItemTypeId, ref IQueryable<ContentItem> query)
  ; {
{
; 如果 (ItemTypeId!= 空 )
if (ItemTypeId != null)
  ; query = query.Where(x => x.ItemType.ItemTypeId!=( ) ItemTypeId);
query = query.Where(x => x.ItemType.ItemTypeId != (int)ItemTypeId);
  ; query = query.Where(x => x.LinkedItem.ItemId == );
query = query.Where(x => x.LinkedItem.ItemId == null);
  ; }
}
查询仅检索那些具有不同itemid的项目,也仅检索那些尚未链接的项目.
The query retrieves only those items which have a different itemid and also only those items which are not yet linked.
我启动了屏幕,看起来一切正常如您在下一张图片的第一张图片中所见
但是,当我添加一个项目时,即使在保存该项目之前,它也会立即显示在要链接的项目列表中.可能不让它立即显示,但是当您单击刷新"链接时,将显示新项目.
However When I add an item It will immediately, even before saving the item, show up in the list of items to be linked. It is possible to not let it show up immediately but when you click the REFRESH link the new item shows up.
请参见下图中的第二个图像.
似乎ContentItems数据集和LinkedItems数据集之间存在某种联系.问题是:如何使这些新项目即使单击刷新按钮也不会显示在列表中?
非常感谢您的帮助.
Thanks for your help in advance.
我完全有 一样 问题 , am 对 感到好奇 其他人可能的解决方案:(
I have exactly the same issue, am curious about the possible solutions by others :(