Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

LINQ Provider for Kooboo Content Repository
jifeng
#1 Posted : Friday, December 18, 2009 2:49:25 PM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,394
Location: Xiamen China
In the kooboo, we provide a very cool content repository include design schema and content management. For now you can use DataRule or ContentService API to query the contents. But it is still a bit complicated, specially the user must to construct a complex query statement. It is not very friendly. I think we can provide a LINQ provider to use LINQ-sytle query content repository. The syntax will be like:

Code:

var content = from "NewsFolder"
where "ContentId" = 1


I think it is more intuitive and simple. What do you think about?
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
tdekoekkoek
#2 Posted : Sunday, December 20, 2009 2:08:06 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 9/23/2009(UTC)
Posts: 57
Location: Atlanta, USA
I think this would be very good. Make sure to throw exceptions for expressions that are not recognized by the provider. I recently had the experience where NHibernate did not interpret an expression in my Where clause, but instead of throwing an exception it just returned the full result set.
jifeng
#4 Posted : Thursday, December 31, 2009 10:07:42 AM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,394
Location: Xiamen China
We've finished the Linq Provider of kooboo content repository. Here I will release some code to demonstrate how to use it.

1. Iterate the contents of folder without any data rule or content service API:
Code:

<ul>
<% foreach (var item in (new FolderContentQueryable("Category")))
{%>
<li>
<%= Html.PageLink(item["Title"].ToString(),"category",new {ContentId= item["ContentId"]}) %>
</li>
<%}%>
</ul>


2. Get the content count of folder:
Code:

<%= (new FolderContentQueryable("Category")).Count()%>


3. Query content by content id and folder:
Code:

<%= (new FolderContentQueryable("Category")).OrderBy(cd=>cd.GetColumn<int>("ContentId")).First()["Title"]%>


4. Query content by content id and schema:
Code:

<% var category = (new SchemaContentQueryable("Category")).Where(cd => cd.GetColumn<int>("ContentId") == ContentId); %>


5. Query contents by category and folder:
Code:

<ul>
<% foreach (var item in (new ContentByCategoryNFolderQueryable(ContentId, "News")))
{%>
<li>
<%= Html.PageLink(item["Title"].ToString(), "newsDetail", new { UserKey = item["UserKey"] })%>
</li>
<%}%>
</ul>


6. Query sub contents:
Code:

<ul>
<% foreach (var item in (new SubContentQueryable((int)content["ContentId"], "Comment")))
{%>
<li>
<%=item["Title"]%>
<%=item["Body"]%>
</li>
<%}%>
</ul>


There are series queryable types to support varied query types.

FolderContentQueryable

SchemaContentQueryable

ContentByCategoryNFolderQueryable

ContentByCategoryNSchemaQueryable

CategoryByContentNFolderQueryable

CategoryByContentNSchemaQueryable

SubContentQueryable
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
jifeng
#3 Posted : Thursday, December 31, 2009 10:20:03 AM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,394
Location: Xiamen China
tdekoekkoek wrote:
I think this would be very good. Make sure to throw exceptions for expressions that are not recognized by the provider. I recently had the experience where NHibernate did not interpret an expression in my Where clause, but instead of throwing an exception it just returned the full result set.


Yes, I throw the NotSupportedException when the expressions not supported. Thanks.
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
tdekoekkoek
#5 Posted : Friday, January 01, 2010 4:30:53 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 9/23/2009(UTC)
Posts: 57
Location: Atlanta, USA
Great! Hope to use these soon. Is this a separate download or will there be a new version?
zguoqi
#6 Posted : Friday, January 01, 2010 9:15:38 AM(UTC)
Rank: Administration
Groups: Registered, Administrators

Joined: 9/2/2009(UTC)
Posts: 690
Location: xiamen
That will be a new version. We hope to release it in the middle of Jan.

Regards,

Vincent

Kooboo Team
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.099 seconds.