ASP.NET Linq To SQL 和嵌套选择
我正在使用 .NET 4,我只是想知道是否有一种优化方法可以实现以下目标。
Public Function GetUserByOpenID(ByVal claimedidentifier As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Where u.ID = (From o In dc.OpenIDs
Where o.ClaimedIdentifier = claimedidentifier
Select o.UserID).FirstOrDefault
Select u)
Return user
End Function
I'm using .NET 4 and I'm just wondering if there is an optimized way of achieving the following.
Public Function GetUserByOpenID(ByVal claimedidentifier As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Where u.ID = (From o In dc.OpenIDs
Where o.ClaimedIdentifier = claimedidentifier
Select o.UserID).FirstOrDefault
Select u)
Return user
End Function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设所有用户在 OpenID 中都有匹配的 ID:
Assuming that all users have a matching ID in OpenIDs:
我本人偏爱 lambda...
I'm partial to lambdas, myself...