Suprise Feature Of The Month: Operator Overloading In Queries...
Like I said in my previous post, this is going to be all commentary. A series of compeltely unplanned actions on my part brought about an interesting result. Take a look at the following query:
Comment commentFromDb = Comment.FindOne(
Where.Comment.Content == "Active Record Rocks!" && Where.Comment.Post == post
);
Give me a comment in this post that also has a "Active Record Rocks!" as its content.
Let us try to do it a little harder, give me a post in any of the following my blog or yours, whose title is either "Operator" or "Overloading":
Post.FindAll(
Where.Post.Blog.In(myBlog, yourBlog) &&
(Where.Post.Title == "Overloading" || Where.Post.Title == "Operator")
);
And in VB.Net...
Post.FindAll( _
Where.Post.Blog = myBlog And _
(Where.Post.Title = "Operator" OrElse _
Where.Post.Title = "Overloading") _
)
Where it is even more natural (try to read it out load).
Note: This require that you would get the new NamedExpression and the ManyToOneNamedExpression files, since they contained the operator overloading stuff.
P.S: I file this post under the Linq category, do you think it deserve it?
Comments
Comment preview