Created
August 23, 2011 05:30
-
-
Save mikeedwards83/1164417 to your computer and use it in GitHub Desktop.
Example of potential strongly typed Sitecore Query using Glass.Sitecore.Mapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SitecoreClass] | |
public class DummyClass{ | |
[SitecoreField] | |
public virtual string MyField{get;set;} | |
[SitecoreField] | |
public virtual DateTime Date{get;set;} | |
} | |
string query = Query | |
.I("sitecore") | |
.I("content") | |
.I("*", Where<DummyClass>(x => x.MyField).Eq("someValue").Add(x => x.Date).EqLs(DateTime.Now)); | |
Assert.AreEqual("/sitecore/content[@MyField='someValue' and @Date <= '20110822T101524']", query); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment