- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个“注释”表。笔记支持一个级别的线程 - 换句话说,您可以回复一条笔记但不能回复另一个回复。所以表格看起来像下面这样:
CREATE TABLE [dbo].[Notes] (
[NoteId] [uniqueidentifier] ROWGUIDCOL NOT NULL DEFAULT (newid())
CONSTRAINT [PK__Notes]
PRIMARY KEY ([NoteId]),
[ParentNoteId] UNIQUEIDENTIFIER NULL,
[NoteText] NVARCHAR(MAX) NOT NULL,
[NoteDate] DATETIME NOT NULL
)
所以我正在使用 Subsonic 事件记录来获取所有“父”注释:
var allNotes = (from n in Note.All()
where n.ParentNoteId == null
orderby n.NoteDate descending
select n)
.Skip((pageIndex - 1) * pageSize).Take(pageSize);
接下来我只是循环遍历 IQueryable 并填充笔记 Guid 的通用列表:
List<Guid> noteList = new List<Guid>();
foreach (var note in allNotes)
{
noteList.Add(note.NoteId);
}
最后,我试图构造一个查询以从原始查询中获取对笔记的所有回复:
replies = from n in Note.All()
where n.ParentNoteId != null && noteList.Contains(n.ParentNoteId.Value)
select n
我收到的错误是:“不支持‘包含’方法”有什么想法吗?
编辑:我尝试转换为如下字符串:
List<String> noteList = new List<String>();
foreach (var note in allNotes)
{
noteList.Add(note.NoteId.ToString());
}
replies = (from n in Note.All()
where n.ParentNoteId != null &&
noteList.Contains(n.ParentNoteId.Value.ToString()) select n);
与之前相同的错误消息。
最佳答案
看来,List<>.Contains 不被 Subsonic 支持。
但是,IEnumerable<>.Contains 是受支持的,所以你可以试试这个:
IEnumerable<string> noteListEnumerable = noteList;
replies = from n in Note.All()
where n.ParentNoteId != null && noteListEnumerable.Contains(n.ParentNoteId.Value)
select n
关于c# - 包含的亚音速查询构造(Guid),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2073257/
我有某些场景(例如,一个自定义类来保存 Sql 参数),其中可能需要也可能不需要变量。传统上,我一直将这些定义为 Guid? 类型,并在使用前使用 myGuid.HasValue 检查有效值。 当然在
在 rpc.h 中,GUID 结构声明如下: typedef struct _GUID { DWORD Data1; WORD Data2; WORD Data3; B
使用 Dynamics CRM 我试图创建一个实体的实例。我想手动设置 GUID,但如果我拥有作为 DynamicEntity 主键的属性,则会出现以下错误。 Service could not pr
我需要将 GUID PK 字段(长度 = 36)发送到只接受 20 个字符长的下游系统。在下游系统中增加字段的长度成本过高。如果我截断该字段,那么我将失去它的唯一性。 有什么方法可以在不丢失唯一性的情
我听说 melissa 蠕虫的创建者因生成的 GUID 可以链接回他使用的计算机的 MAC 地址而被定罪。 做到这一点有多难?除了 GUID,他们还需要哪些数据?喜欢 MAC 地址本身还是创建时间?
使用 GUID 作为文件名和 นด 上传的图像以避免重复有什么缺点吗? 最佳答案 您的文件名将是唯一的,真的。但是没有任何方法可以按任何顺序对它们进行排序。 您可以使用 Unix TimeStamp在
我正在做一些互操作,需要传递一些 GUID。有没有办法将 GUID 属性添加到枚举值,并且当它被编码时它具有适当的值? 基本上我正在尝试转换代码 #if !defined( STATIC_KSDATA
我有一个文件,其中包含大量出现的字符串 Guid="GUID HERE" (其中 GUID HERE 在每次出现时都是唯一的 GUID),我想用新的唯一 GUID 替换每个现有的 GUID。 这是在
我已经向我们的客户发送了 10000 封邮件,每封邮件都有一个格式的链接 http://example.com/LogIn?key={guid} 不幸的是guid我发送的是随机 guids(由 Gui
使用 Breeze,在创建实体时填充 GUID 键的最简单方法是什么? 最佳答案 我假设您的实体已配置为客户端负责为新实体设置 Guid 键。这是 Entity Framework 代码优先实体的 G
我看到这两个首字母缩略词被抛出,我想知道 GUID 和 UUID 之间是否有任何区别? 最佳答案 简单回答是:**没有区别,它们是同一个东西。 2020-08-20 更新 :虽然 GUID(由 Mic
我注意到有些人不打算使用通常的递增数字作为 ID,而是简单地生成 GUID。优点包括: 快速简单 无需跟踪以前的 ID 即使在机器之间互不了解的情况下也能保证唯一性 一些缺点是: 可能存在性能瓶颈 使
我是 C++/CLI 的新手,我正在尝试将 native C++ GUID 转换为我的 C++/CLI Guid^。尝试转换时: BlockInfo^ blockInfo = gcnew BlockI
这个问题在这里已经有了答案: 11 年前关闭。 Possible Duplicate: Is there any difference between a GUID and a UUID? GUID
我正在使用 Data::GUID生成 GUID。然而,每当我在同一个“ session ”中生成 GUID,即运行脚本时,唯一改变的数字是最前面的数字: 3BAF1240-0573-11E4-B31C
我有一个对象列表,它们具有 id 的 guid。我想使用这个对象列表中的 id 创建一个 guid,我可以使用它来确保列表没有改变。如果删除/添加了一个对象,则 guid 会有所不同。我想到的是使用哈
上下文:ASP.NET Web API v2 给定一个类似于这个的 URL: http://localhost/something?id=cbc66d32-ece8-400f-a574-e36b911
这是将 Guid 转换为 Guid 的惯用方法吗?? new Guid?(new Guid(myString)); 最佳答案 不,这是: Guid? foo = new Guid(myString);
我想从输入字符串生成一个 GUID。假设我从用户那里收到了 guid,它是 81a130d2-502f-4cf1-a376-63edeb000e9f 所以我可以这样做: Guid g = Guid.
为什么无参数 Guid 构造函数生成一个空 GUID,而不是像 Guid.NewGuid() 那样默认生成一个? 空 Guid 是否有特殊用途? 最佳答案 Why does the parameter
我是一名优秀的程序员,十分优秀!