online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
using System; using System.Linq.Expressions; using System.Data.Entity; using System.Linq; public class Program { static void SomeDbRequest(Expression<Func<Person, bool>> condition, Expression<Func<DbEntities, Person, bool>> advancedCondition) { using (DbEntities db = new DbEntities()) { var query = db.Set<Person>().AsQueryable(); var result1 = query.Where(condition).ToList(); //это работает var result2 = query.Where(x => advancedCondition.Compile().Invoke(db, x)); //это нет //NotSupportedException: 'LINQ to Entities' erkennt die Methode 'Boolean Invoke(DbEntities, Person)' nicht, //und diese Methode kann nicht in einen Speicherausdruck übersetzt werden. } } static void Main(string[] args) { Expression<Func<Person, bool>> c1 = p => p.Name == "Peter"; Expression<Func<DbEntities, Person, bool>> c2 = (db, p) => db.Set<Event>().Any(e => e.Author == p.Name); SomeDbRequest(c1, c2); } class DbEntities : DbContext { } class Person { public string Name { get; set; } } class Event { public string Description { get; set; } public string Author { get; set; } } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue