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

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - 数码幽灵

[转贴] 网络硬盘“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解决,但是那样做不是相当的不优雅的吗?