- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
LLBLGen with XtraGrid in sever mode?
Joined: 02-Mar-2006
Hi,
I was wondering if anybody is successfully using LINQ to LLBLGen with the DevExpress XtraGrid in server mode?
I did some test for a few minutes but as soon as I used filtering, or an entity in a hierarchy it wouldn't work anymore.
Thanks for any help, Patrick
I used ServerMode with a LookupEdit successfully. I thought all controls worked off the same API. It should work for you as well. One thing that you might have done is dispose the adapter that the queryable is using. This would for sure make it choke.
Joined: 02-Mar-2006
Here is the code I use (it's from other threads in the forum): Otherwise there is no code on the form.
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.DesignMode) return;
var da = new DataAccessAdapter(true);
//da.StartTransaction(System.Data.IsolationLevel.ReadUncommitted, "CreateNoLockAdapter");
var metaData = new LinqMetaData(da);
linqServerModeSource1.ElementType = typeof(DAL.EntityClasses.MyItemVersionBaseEntity);
linqServerModeSource1.KeyExpression = "ItemVersionId";
var q = (from c in metaData.ItemVersionBase
select c);
linqServerModeSource1.QueryableSource = q;
gridControl1.DataSource = linqServerModeSource1;
gridControl1.ServerMode = true;
}
As soon as I use an auto filter it says object not set to an instance and mentions "ItemVersionId" even though it does exist and worked in the first place to fill the grid.
Thanks, Patrick
Joined: 02-Mar-2006
Seth wrote:
I think I have the queryable object as a member of the class and not a member of the function itself.
Thank you it didn't make a difference...
Here is what happens:
SELECT LPA_L1.SubTypeID
FROM (SELECT F11_2
FROM (SELECT LPA_L4.ItemVersionId AS F11_0, LPA_L4.ItemId AS F11_1, LPA_L4.SubClassTypeID AS F11_2
FROM ItemVersion AS LPA_L4 LEFT OUTER JOIN
ItemVersionData AS LPA_L5 ON LPA_L4.ItemVersionId = LPA_L5.ItemVersionId LEFT OUTER JOIN
ItemVersionTake AS LPA_L6 ON LPA_L4.ItemVersionId = LPA_L6.ItemVersionId) AS LPA_L3
GROUP BY F11_2) AS LPA_L1
ORDER BY LPA_L1.SubTypeID
With this error message: SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException occurred Message="An exception was caught during the execution of a retrieval query: Invalid column name 'SubTypeID'.\r\nInvalid column name 'SubTypeID'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception." Source="SD.LLBLGen.Pro.ORMSupportClasses.NET20" RuntimeBuild="01162009" RuntimeVersion="2.6.0.0"
As you see something went wrong with the aliases. I removed some fields from the select to make it shorter by the way.
Thanks, Patrick
SELECT LPA_L1.SubTypeID FROM (SELECT F11_2 FROM (SELECT LPA_L4.ItemVersionId AS F11_0, LPA_L4.ItemId AS F11_1, LPA_L4.SubClassTypeID AS F11_2 FROM ItemVersion AS LPA_L4 LEFT OUTER JOIN ItemVersionData AS LPA_L5 ON LPA_L4.ItemVersionId = LPA_L5.ItemVersionId LEFT OUTER JOIN ItemVersionTake AS LPA_L6 ON LPA_L4.ItemVersionId = LPA_L6.ItemVersionId) AS LPA_L3 GROUP BY F11_2) AS LPA_L1 ORDER BY LPA_L1.SubTypeID
Nothing wrong with the aliases, the thing is there is no SubTypeID field to select in the outer most query.
Looks like an inheritance related problem, however these should work OK as well.
Could you post more relevant info? I.e. switch on tracing on level 3 for the Linq provider in the config file of your application, so you'll see the expression tree in text. Then describe the inheritance hierarchy of the entities involved and their tables.
Joined: 02-Mar-2006
Otis wrote:
Could you post more relevant info?
Tables: ItemVersion > ItemVersionData ItemVersion >ItemVersionTake
Inheritance: MyItemVersionBaseEntity > MyItemVersionDataEntity MyItemVersionBaseEntity >MyItemVersionTakeEntity
Trace:
: Initial expression to process:
value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[CFX.Amanda.DAL.EntityClasses.MyItemVersionBaseEntity]).Select(c => c).GroupBy( => .SubTypeID).OrderBy( => .Key).Select( => .Key)
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSubQuery
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSubQuery
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT [LPA_L4].[ItemVersionId] AS [F11_0], [LPA_L4].[ItemId] AS [F11_1], [LPA_L4].[SubClassTypeID] AS [F11_2], [LPA_L4].[VersionNumber] AS [F11_3] FROM (( [dbo].[ItemVersion] [LPA_L4] LEFT JOIN [dbo].[ItemVersionData] [LPA_L5] ON [LPA_L4].[ItemVersionId]=[LPA_L5].[ItemVersionId]) LEFT JOIN [dbo].[ItemVersionTake] [LPA_L6] ON [LPA_L4].[ItemVersionId]=[LPA_L6].[ItemVersionId])
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query:
Query: SELECT [LPA_L3].[F11_2] FROM (SELECT [LPA_L4].[ItemVersionId] AS [F11_0], [LPA_L4].[ItemId] AS [F11_1], [LPA_L4].[SubClassTypeID] AS [F11_2], [LPA_L4].[VersionNumber] AS [F11_3] FROM (( [dbo].[ItemVersion] [LPA_L4] LEFT JOIN [dbo].[ItemVersionData] [LPA_L5] ON [LPA_L4].[ItemVersionId]=[LPA_L5].[ItemVersionId]) LEFT JOIN [dbo].[ItemVersionTake] [LPA_L6] ON [LPA_L4].[ItemVersionId]=[LPA_L6].[ItemVersionId])) [LPA_L3] GROUP BY [LPA_L3].[F11_2]
Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query:
Query: SELECT [LPA_L1].[SubTypeID] FROM (SELECT [LPA_L3].[F11_2] FROM (SELECT [LPA_L4].[ItemVersionId] AS [F11_0], [LPA_L4].[ItemId] AS [F11_1], [LPA_L4].[SubClassTypeID] AS [F11_2], [LPA_L4].[VersionNumber] AS [F11_3] FROM (( [dbo].[ItemVersion] [LPA_L4] LEFT JOIN [dbo].[ItemVersionData] [LPA_L5] ON [LPA_L4].[ItemVersionId]=[LPA_L5].[ItemVersionId]) LEFT JOIN [dbo].[ItemVersionTake] [LPA_L6] ON [LPA_L4].[ItemVersionId]=[LPA_L6].[ItemVersionId])) [LPA_L3] GROUP BY [LPA_L3].[F11_2]) [LPA_L1] ORDER BY [LPA_L1].[SubTypeID] ASC
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Error:
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException occurred
Message="An exception was caught during the execution of a retrieval query: Invalid column name 'SubTypeID'.\r\nInvalid column name 'SubTypeID'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."
Source="SD.LLBLGen.Pro.ORMSupportClasses.NET20"
RuntimeBuild="01162009"
RuntimeVersion="2.6.0.0"
QueryExecuted="\r\n\tQuery: SELECT [LPA_L1].[SubTypeID] FROM (SELECT [LPA_L3].[F11_2] FROM (SELECT [LPA_L4].[ItemVersionId] AS [F11_0], [LPA_L4].[ItemId] AS [F11_1], [LPA_L4].[SubClassTypeID] AS [F11_2], [LPA_L4].[VersionNumber] AS [F11_3] FROM (( [dbo].[ItemVersion] [LPA_L4] LEFT JOIN [dbo].[ItemVersionData] [LPA_L5] ON [LPA_L4].[ItemVersionId]=[LPA_L5].[ItemVersionId]) LEFT JOIN [dbo].[ItemVersionTake] [LPA_L6] ON [LPA_L4].[ItemVersionId]=[LPA_L6].[ItemVersionId])) [LPA_L3] GROUP BY [LPA_L3].[F11_2]) [LPA_L1] ORDER BY [LPA_L1].[SubTypeID] ASC\r\n"
StackTrace:
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
at CFX.Amanda.DAL.DatabaseSpecific.DataAccessAdapter.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior) in D:\Dev\VS\CFX.Amanda\Trunk\src\CFX.Amanda.DAL\DatabaseSpecific\DataAccessAdapter.cs:line 292
InnerException: System.Data.SqlClient.SqlException
Message="Invalid column name 'SubTypeID'.\r\nInvalid column name 'SubTypeID'."
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=207
Procedure=""
Server="FA-SQL-001"
State=1
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
InnerException:
Thanks, Patrick
pat wrote:
Otis wrote:
Could you post more relevant info?
Tables: ItemVersion > ItemVersionData ItemVersion >ItemVersionTake
Inheritance: MyItemVersionBaseEntity > MyItemVersionDataEntity MyItemVersionBaseEntity >MyItemVersionTakeEntity
Trace: [code]: Initial expression to process: value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[CFX.Amanda.DAL.EntityClasses.MyItemVersionBaseEntity]).Select(c => c).GroupBy( => .SubTypeID).OrderBy( => .Key).Select( => .Key)
When I ask for more info, please provide ALL info you can provide. The query targets 1 entity only. The 'My' prefixes, is that due to adapter two-class scenario? What's the tables look like? What's the inheritance type? Remember, I don't see your code in front of me, so I need ALL information you can provide me to reproduce it, otherwise we've to give up and ask for a repro case build by you.
Thanks.