惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - 数码幽灵

[转贴] 网络硬盘“G宝盘”使用体验 - 数码幽灵 - 博客园 个人拼图 有关Web项目使用EnterpriseLibrary的Sercurity问题 - 数码幽灵 - 博客园 关于使用VS.Net2003调试器出现的问题及相关解决方法 关于JavaScript一次提交多个Form出现的问题 看到关于Zope的一些东西 关于SmartClient 与 游戏开发的一点想法 关于Alex 的 ProcessContext 今天看到AppForge的产品 Base4.Net 即将推出 V1.0 WS-Security学习 发现了C-Omega Essential ASP.NET 读书笔记--Configuration Essential ASP.NET 读书笔记--WebForm Essential ASP.NET 读书笔记--基础 Visual Studio 2005 Express Download Test Driven C# 读书笔记(下) Test Driven C# 读书笔记(上) 每个.Net开发者现在应该下载的十个必备工具!
使用Base4.Net进行项目开发中的问题
数码幽灵 · 2005-03-29 · via 博客园 - 数码幽灵

最近在使用Base4.Nethttp://www.base4.net开发一个台帐管理系统,定义了一个类NoteCategory

现在查询的需求是查出所有typeof(NoteCategory)的对象,满足Parents.Count = 0的条件;
但是发现使用ObjectPath "Parents.Count=0"或"Parents[Count]=0"都无法进行查询,还抛出了异常;于是就到了Base4.Net的Forums上去问,结果得到的答案是:

Ask (Me) :

I defined a Class "NoteCategory" that contains a attribute "Parents"

the attribute is a Collection

how to query the object typeof(NoteCategory) that Parents.Count = 0  ?????

How to constuct the objectpath ??

thanks very much!!!!

Answer: (Alex James)

I don't support embedding a count filter on a relationship in objectpath yet... sorry.

Although what you are asking for should be added... I will have a think about how in the next few days.
The problem is that I collapse calls to object.Relationship so that you are querying the related object not the actual relationship table.

What needs to be done is to add additional HardCoded filters to the object.Relationship so that you can do the sort of things you are asking for....I will probably add support for this before Beta3.

While you can't do it with object path you can do it...

If you use an ObjectCommand and write the SQL yourself.
Execute the ObjectCommand so it returns a reader (ExecuteReader) and contruct an ObjectDataReader around the returned reader so you can read your NoteCategory objects.

It depends how you defined your RelationshipDef, if Parent is defined with LinkIsSource and a RelationshipName = Parent
This would return you all NoteCategories without parents:
SELECT * FROM [NOTECATEGORY] WHERE ID NOT IN (SELECT  DISTINCT(Source) FROM [Maxtiviti.Storage.Relationship] WHERE Name = 'Parent')

When I get a chance I will post you a snippet on how to use this code with a ObjectCommand...

呵呵,真希望alex快出beta3版啊,要不我用以下的解决方案,有很大的性能问题啊:

虽然可以用alex提出的方法写Sql解决,但是那样做不是相当的不优雅的吗?