Search Results

Search found 3 results on 1 pages for 'yoenhofen'.

Page 1/1 | 1 

  • How can I extend DynamicQuery.cs to implement a .Single method?

    - by Yoenhofen
    I need to write some dynamic queries for a project I'm working on. I'm finding out that a significant amount of time is being spent by my program on the Count and First methods, so I started to change to .Single, only to find out that there is no such method. The code below was my first attempt at creating one (mostly copied from the Where method), but it's not working. Help? public static object Single(this IQueryable source, string predicate, params object[] values) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); LambdaExpression lambda = DynamicExpression.ParseLambda(source.ElementType, typeof(bool), predicate, values); return source.Provider.CreateQuery( Expression.Call( typeof(Queryable), "Single", new Type[] { source.ElementType }, source.Expression, Expression.Quote(lambda))); }

    Read the article

  • Illegal Argument Exception in Google Wave App

    - by Yoenhofen
    I'm writing a Google Wave robot and I just messed something up. It was working just fine but now I'm getting an IllegalArgument exception on the line that includes query.execute. Am I doing something stupid? I've seen several code samples very similar to what I'm doing. I can include the code of the WaveUpdate class if necessary. The intent here is to select all WaveUpdate members that have an updateDateTime in the last hour. PersistenceManager pm = PMF.get().getPersistenceManager(); try { Query query = pm.newQuery(WaveUpdate.class); query.setFilter("emailAddress > '' && updateDateTime > referenceDateTime"); query.declareParameters("java.util.Date referenceDateTime"); Calendar referenceDateTime = Calendar.getInstance(); referenceDateTime.add(Calendar.HOUR_OF_DAY, -1); List<WaveUpdate> updates = (List<WaveUpdate>) query.execute(referenceDateTime.getTime());

    Read the article

1