Other than int?

Jan 7, 2011 at 9:59 PM

How do I get the following running? I get "An error occured while compiling the LINQ query: 17 : 56 -> The type or namespace name 'LCConsoleTestCS' could not be found (are you missing a using directive or an assembly reference?)"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Evaluant.Linq.Compiler;

namespace LCConsoleTestCS
{
    class Program
    {
        static void Main(string[] args)
        {
            LinqCompiler lc = new LinqCompiler("from e in source select e");
            lc.AddSource<WinEvent>("source", new WinEvent[] { });
            var result = lc.Evaluate<WinEvent>();
        }

        class WinEvent
        {
            public int EventID { get; set; }
            public string EventSource { get; set; }
            public string EventType { get; set; }
        }

    }
}

Mar 26, 2011 at 6:25 PM

Please don't make us analyze the code to understand how to use the tool.

 

In case someone else comes here with same question, this is how it's done:

lc.ExternalAssemblies.Add(typeof(WinEvent).Assembly);

This is also not mentioned in the example on the front page, nor is it documented in code; this is how you add parameters to the query :

"from e in source where e.Something == @param1 select e"

lc.Values.Add("param1", something);