I am using the QueryBuilder
as following:
var queryString = String.Format(
"SELECT VALUE e FROM Entity AS e WHERE e.EndDate {0} {1} ",
operator,
DateTime.Today.AddYears(1).ToString("d", DateTimeFormatInfo.InvariantInfo)
);
ObjectQuery<Entity> query = new ObjectQuery<Entity>(queryString, Context);
Please note that I extremely simplified this example and that my goal is to build the query as string before creating a QueryBuilder
instance. (As long as this is possible)
I already tried the following
...DateTime.Today.AddYears(1)...
...DateTime.Today.AddYears(1).ToString()...
...DateTime.Today.AddYears(1).ToString("yyy\MM\dd")...
which all result in a exception which says that I either cannot compare DateTime with a String or with a Int32.
I'm beginning to asking me if this is possible at all with this approach...