in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

strange EntityCommandCompilationException occurrence

Last post 08-02-2010 6:58 AM by chris84. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 08-02-2010 6:58 AM

    strange EntityCommandCompilationException occurrence

    We use EF4 with POCO Classes with the following entity model:

    Include problem

    To get all Projects i tried something like this:

    return dataServerDBContext.Project
        .Include("Logger")
        .Include("ForeignLogger")
        .Include("Logger.Sensor")
        .Include("Logger.Inverter")
        .Include("Logger.Inverter.InverterType")
        .ToList();

    When i comment out the Sensor include this works quite well. When commenting out the Inverter and InverterData it also works. But when i try to get the Project with Sensors and Inverters i get an EntityCommandCompilationException:


    System.Data.EntityCommandCompilationException wurde nicht von Benutzercode behandelt.
      Message=Fehler bei der Vorbereitung der Befehlsdefinition. Weitere Informationen finden Sie in der internen Ausnahme.
      Source=System.Data.Entity
      StackTrace:
           bei System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
           bei System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
           bei System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Span span, ReadOnlyCollection`1 compiledQueryParameters)
           bei System.Data.Objects.EntitySqlQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
           bei System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
           bei System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
           bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
           bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
           bei balticSD.SunvoltEnergyStudio.Server.Persistency.SqlAdminPersistency.GetAllProjects() in D:\Visual Studio Projekte\SunvoltEnergyStudio Codename Sulis\SQLCompactProvider\SqlAdminPersistency.cs:Zeile 1388.
           bei DataManagementTool.MainForm.reloadServerItems() in D:\Visual Studio Projekte\SunvoltEnergyStudio Codename Sulis\DataManagementTool\MainForm.cs:Zeile 76.
           bei DataManagementTool.MainForm.MainForm_Load(Object sender, EventArgs e) in D:\Visual Studio Projekte\SunvoltEnergyStudio Codename Sulis\DataManagementTool\MainForm.cs:Zeile 364.
           bei System.Windows.Forms.Form.OnLoad(EventArgs e)
           bei System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           bei System.Windows.Forms.Control.CreateControl()
           bei System.Windows.Forms.Control.WmShowWindow(Message& m)
           bei System.Windows.Forms.Control.WndProc(Message& m)
           bei System.Windows.Forms.Form.WndProc(Message& m)
           bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      InnerException: System.NotSupportedException
           Message=apply expression
           Source=System.Data.SQLite.Linq
           StackTrace:
                bei System.Data.SQLite.SqlChecker.Visit(DbApplyExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpression(DbExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpressionBinding(DbExpressionBinding expressionBinding)
                bei System.Data.SQLite.SqlChecker.Visit(DbProjectExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpression(DbExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitBinaryExpression(DbBinaryExpression expr)
                bei System.Data.SQLite.SqlChecker.Visit(DbUnionAllExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpression(DbExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpressionBinding(DbExpressionBinding expressionBinding)
                bei System.Data.SQLite.SqlChecker.Visit(DbSortExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpression(DbExpression expression)
                bei System.Data.SQLite.SqlChecker.VisitExpressionBinding(DbExpressionBinding expressionBinding)
                bei System.Data.SQLite.SqlChecker.Visit(DbProjectExpression expression)
                bei System.Data.SQLite.SqlChecker.Rewrite(DbQueryCommandTree tree)
                bei System.Data.SQLite.SqlGenerator.GenerateSql(DbQueryCommandTree tree)
                bei System.Data.SQLite.SqlGenerator.GenerateSql(SQLiteProviderManifest manifest, DbCommandTree tree, List`1& parameters, CommandType& commandType)
                bei System.Data.SQLite.SQLiteProviderServices.CreateCommand(DbProviderManifest manifest, DbCommandTree commandTree)
                bei System.Data.SQLite.SQLiteProviderServices.CreateDbCommandDefinition(DbProviderManifest manifest, DbCommandTree commandTree)
                bei System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
           InnerException:


    (sorry, german system)


    I have absolutely no idea why this happens this way. Maybe i'm exceeding some branch limits of the include statements? I'd be grateful if anyone could give me a hint or maybe an alternative approach.

    PS: The UniqueSensorSN of the Sensor is normally UniqueSN, like the properties of Logger and Inverter. This was just for testing if this problem has something to do with the concurrent property names within the entities.

    PPS: I have made a small demo application which reproduces the error. This has been tested with the MsSQL Compact provider, which works fine. So it seems to be a problem with the sqlite provider. I can send the demo application per email to you for further testing.

Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems