Generated Sql Query in Error

Posts   
 
    
SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 27-Jul-2009 17:13:25   

Hi,

First some info: - Version: LLBLGen Pro 2.6.0.0 - DB: SQL 2008 - Template: Adapter with .Net 2.0

When I executed my linq Query (CommunityPointOfSale is an association table With Community And PointOfSale)

using (var adapter = new DataAccessAdapter()) { var convergenceMetaData = new LinqMetaData(adapter); var linkExists = convergenceMetaData.CommunityPointOfSale.Where( cpos => cpos.CommunityId == communityId && cpos.PointOfSaleId == pointOfSaleId) .Any(); }

The generated Sql query is on error. The alias created for the [Developpement].[dbo].[CommunautePointVente] is **LPLA_1 **whereas the alias used in the query is [LPA_L1].

Can you explain me where is the problem?

Thanks for your help. Seb

Generated Sql query: Query: SELECT [LPA_L1].[PointOfSaleId] FROM (SELECT [LPA_L1].[IdentifiantPointVente] AS [PointOfSaleId], [LPA_L1].[IdentifiantCommunaute] AS [CommunityId] FROM [Developpement].[dbo].[CommunautePointVente] [LPLA_1] WHERE ( ( ( [LPA_L1].[IdentifiantCommunaute] = @CommunityId1) AND ( [LPA_L1].[IdentifiantPointVente] = @PointOfSaleId2)))) [LPA_L1] Parameter: @CommunityId1 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1798. Parameter: @PointOfSaleId2 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1522.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 27-Jul-2009 18:08:59   

Runtime build nr? http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725

have you tried with the latest build? (and you're using linq so you're using .net 3.5, not .net 2.0 wink )

Frans Bouma | Lead developer LLBLGen Pro
SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 27-Jul-2009 18:26:11   

Sorry , I used linq with .Net 3.5

Runtime library used: - SD.LLBLGen.Pro.LinqSupportClasses.NET35 v2.0.50727 - SD.LLBLGen.Pro.ORMSupportClasses.NET20 v2.0.50727

Seb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 27-Jul-2009 19:12:55   

those are the .net build nrs, please use:

The runtime library version is obtainable by rightclicking the SD.LLBLGen.Pro.ORMSupportClasses.NETxy.dll in windows explorer and then by selecting properties and the version tab. The version is then enlisted at the top as the fileversion. It has the typical format as 2.0.0.YYMMDD, or starting in 2007, the format 2.0.YY.MMDD

and please try the latest build of the runtime libs to see if the problem is fixed or not already.

Frans Bouma | Lead developer LLBLGen Pro
SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 28-Jul-2009 09:44:07   

Hi,

The SD.LLBLGen.Pro.ORMSupportClasses.NET20.dl version that I used is 2.6.9.511

It's the latest version of the runtime libraries?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 28-Jul-2009 10:42:33   

No, the latest RTL build is: 2.6.9.717 (07172009)

SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 28-Jul-2009 12:51:03   

I'm sorry but the latest RTL build that I downloaded this morning is - SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll 2.6.9.703 - SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll 2.6.9.622

I try with this version but i have always the problem.

Thanks for your help. Seb

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 28-Jul-2009 13:06:49   

Are you sure the posted query is corresponding to the posted code?

The C# code is querying CommunityPointOfSale. While the SQL is querying CommunautePointVente.

SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 28-Jul-2009 13:52:29   

Yes, the query is corresponding to the posted code. The Physical Data Model is in French and we decided to generate the object entities in English.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Jul-2009 15:19:51   

And what is the actual exception that you are getting ?

SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 28-Jul-2009 16:59:11   

MTrinder wrote:

And what is the actual exception that you are getting ?

Initial expression to process: value

(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[Glf.Convergence .Community.Business. Entities.EntityClasses.CommunityPointOfSaleEntity]).Where(cpos => ((cpos.CommunityId = value(Glf.Convergence.Community.Business.Components.CommunityBusiness+<>c__DisplayClass8b).communityId) && (cpos.PointOfSaleId = value(Glf.Convergence.Community.Business.Components.CommunityBusiness+<>c__DisplayClass8b).pointOfSaleId))).Any()
'Glf.Convergence.Community.Hosts.ConsoleHost.vshost.exe' (Managed): Loaded 'Anonymously Hosted DynamicMethods Assembly'
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_L1].[IdentifiantPointVente] AS [PointOfSaleId], [LPA_L1].[IdentifiantCommunaute] AS [CommunityId] FROM [Developpement].[dbo].[CommunautePointVente] [LPLA_1]  WHERE ( ( ( [LPA_L1].[IdentifiantCommunaute] = @CommunityId1) AND ( [LPA_L1].[IdentifiantPointVente] = @PointOfSaleId2)))
    Parameter: @CommunityId1 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1810.
    Parameter: @PointOfSaleId2 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1522.

Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT [LPA_L1].[PointOfSaleId] FROM (SELECT [LPA_L1].[IdentifiantPointVente] AS [PointOfSaleId], [LPA_L1].[IdentifiantCommunaute] AS [CommunityId] FROM [Developpement].[dbo].[CommunautePointVente] [LPLA_1]  WHERE ( ( ( [LPA_L1].[IdentifiantCommunaute] = @CommunityId1) AND ( [LPA_L1].[IdentifiantPointVente] = @PointOfSaleId2)))) [LPA_L1]
    Parameter: @CommunityId1 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1810.
    Parameter: @PointOfSaleId2 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1522.

Method Exit: CreateSelectDQ
Method Exit: CreateSubQuery
Generated Sql query: 
    Query: SELECT TOP(@top2) CASE WHEN  EXISTS (SELECT [LPA_L1].[PointOfSaleId] FROM (SELECT [LPA_L1].[IdentifiantPointVente] AS [PointOfSaleId], [LPA_L1].[IdentifiantCommunaute] AS [CommunityId] FROM [Developpement].[dbo].[CommunautePointVente] [LPLA_1]  WHERE ( ( ( [LPA_L1].[IdentifiantCommunaute] = @CommunityId1) AND ( [LPA_L1].[IdentifiantPointVente] = @PointOfSaleId2)))) [LPA_L1]) THEN 1 ELSE 0 END AS [LPFA_1] FROM [Developpement].[dbo].[CommunautePointVente] [LPLA_1] 
    Parameter: @CommunityId1 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1810.
    Parameter: @PointOfSaleId2 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1522.
    Parameter: @top2 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.

Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: DataAccessAdapterBase.OpenConnection
Method Exit: DataAccessAdapterBase.OpenConnection
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll
Method Enter: DataAccessAdapterBase.CloseConnection
Method Exit: DataAccessAdapterBase.CloseConnection
Method Enter: TransactionResourceManager.Rollback
Method Exit: TransactionResourceManager.Rollback
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in Glf.Convergence.Community.Services.dll
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in Glf.Convergence.Community.Hosts.ConsoleHost.exe
'Glf.Convergence.Community.Hosts.ConsoleHost.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Transactions.resources\2.0.0.0_fr_b77a5c561934e089\System.Transactions.resources.dll'
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Exception non gérée</Description><AppDomain>Glf.Convergence.Community.Hosts.ConsoleHost.vshost.exe</AppDomain><Exception><ExceptionType>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27</ExceptionType><Message>An exception was caught during the execution of a retrieval query: L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.</Message><StackTrace>   à SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
   à Glf.Convergence.Community.Business.Entities.DatabaseSpecific.DataAccessAdapter.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Data.DBSpecific\DatabaseSpecific\DataAccessAdapter.cs:ligne 292
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Dictionary`2 typeConvertersToRun)
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IEntityFields2 fields, IRelationPredicateBucket filter, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   à System.Linq.Queryable.Any[TSource](IQueryable`1 source)
   à Glf.Convergence.Community.Business.Components.CommunityBusiness.AttachThisPointOfSaleToThisGroup(Int64 pointOfSaleId, Int64 communityId) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Business.Components\CommunityBusiness.cs:ligne 1676
   à Glf.Convergence.Community.Services.CommunityService.Glf.Convergence. Community.Services.Contract.ServiceContract.ICommunityServiceContract.AttachThisPointOfSaleToThisGroup(Int64 pointOfSaleId, Int64 communityId) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Services\CommunityService.cs:ligne 333
   à Glf.Convergence.Community.Services.CommunityService.TestSegmentationHierarchy() dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Services\CommunityService.cs:ligne 1072
   à Glf.Convergence.Community.Hosts.ConsoleHost.Program.Test() dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Hosts.ConsoleHost\Program.cs:ligne 70
   à Glf.Convergence.Community.Hosts.ConsoleHost.Program.Main(String[] args) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Hosts.ConsoleHost\Program.cs:ligne 60
   à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. ---&amp;gt; System.Data.SqlClient.SqlException: L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
   à System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   à System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   à System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   à System.Data.SqlClient.SqlDataReader.get_MetaData()
   à System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   à System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   à System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   à SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   --- Fin de la trace de la pile d'exception interne ---
   à SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
   à Glf.Convergence.Community.Business.Entities.DatabaseSpecific.DataAccessAdapter.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Data.DBSpecific\DatabaseSpecific\DataAccessAdapter.cs:ligne 292
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Dictionary`2 typeConvertersToRun)
   à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IEntityFields2 fields, IRelationPredicateBucket filter, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
   à SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   à System.Linq.Queryable.Any[TSource](IQueryable`1 source)
   à Glf.Convergence.Community.Business.Components.CommunityBusiness.AttachThisPointOfSaleToThisGroup(Int64 pointOfSaleId, Int64 communityId) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Business.Components\CommunityBusiness.cs:ligne 1676
   à Glf.Convergence.Community.Services.CommunityService.Glf.Convergence.Community.Services. Contract.ServiceContract.ICommunityServiceContract.AttachThisPointOfSaleToThisGroup(Int64 pointOfSaleId, Int64 communityId) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Services\CommunityService.cs:ligne 333
   à Glf.Convergence.Community.Services.CommunityService.TestSegmentationHierarchy() dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Services\CommunityService.cs:ligne 1072
   à Glf.Convergence.Community.Hosts.ConsoleHost.Program.Test() dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Hosts.ConsoleHost\Program.cs:ligne 70
   à Glf.Convergence.Community.Hosts.ConsoleHost.Program.Main(String[] args) dans C:\Dev\Convergence\Main\Projects\Convergence\Server\Glf.Convergence.Community.Hosts.ConsoleHost\Program.cs:ligne 60
   à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.</Message><StackTrace>   à System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   à System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   à System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   à System.Data.SqlClient.SqlDataReader.get_MetaData()
   à System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   à System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   à System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   à SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)</StackTrace><ExceptionString>System.Data.SqlClient.SqlException: L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantPointVente" ne peut pas être lié.
L'identificateur en plusieurs parties "LPA_L1.IdentifiantCommunaute" ne peut pas être lié.
   à System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   à System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   à System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   à System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   à System.Data.SqlClient.SqlDataReader.get_MetaData()
   à System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   à System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   à System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   à System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   à SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Jul-2009 07:26:09   

Reproduced. This is what I get:

RTL ORMSupportClasses 2.6.09.0703 LinqSupportClasses: 2.6.09.0622

**Code **(against AdventureWorks db)

using (var adapter = new DataAccessAdapter())
{
    LinqMetaData metaData = new LinqMetaData(adapter);
    bool exists = metaData.Customer.Where(
        c => c.CustomerId == 15758).Any();
}

Exception

SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: The multi-part identifier "LPA_L1.CustomerID" could not be bound. The multi-part identifier "LPA_L1.CustomerID" could not be bound. The multi-part identifier "LPA_L1.TerritoryID" could not be bound. The multi-part identifier "LPA_L1.AccountNumber" could not be bound. The multi-part identifier "LPA_L1.CustomerType" could not be bound. The multi-part identifier "LPA_L1.rowguid" could not be bound. The multi-part identifier "LPA_L1.ModifiedDate" could not be bound.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. ---> System.Data.SqlClient.SqlException: The multi-part identifier "LPA_L1.CustomerID" could not be bound. The multi-part identifier "LPA_L1.CustomerID" could not be bound. The multi-part identifier "LPA_L1.TerritoryID" could not be bound. The multi-part identifier "LPA_L1.AccountNumber" could not be bound. The multi-part identifier "LPA_L1.CustomerType" could not be bound. The multi-part identifier "LPA_L1.rowguid" could not be bound. The multi-part identifier "LPA_L1.ModifiedDate" could not be bound..

Stack trace

System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) System.Data.SqlClient.SqlDataReader.ConsumeMetaData() System.Data.SqlClient.SqlDataReader.get_MetaData() System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) in ...\RuntimeLibraries\Net2.x\ORMSupportClasses\Query\RetrievalQuery.cs: line 106 SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) in ...\RuntimeLibraries\Net2.x\ORMSupportClasses\Query\RetrievalQuery.cs: line 113 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior) in ...\RuntimeLibraries\Net2.x\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs: line 1524 AW.DatabaseSpecific.DataAccessAdapter.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior) in ...\AW Adpater\code\DAL\DatabaseSpecific\DataAccessAdapter.cs: line 293 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Dictionary2 typeConvertersToRun) in ...\RuntimeLibraries\Net2.x\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs: line 1661 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List1 valueProjectors, IGeneralDataProjector projector, IEntityFields2 fields, IRelationPredicateBucket filter, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize) in ...\RuntimeLibraries\Net2.x\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs: line 1623 SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute) in ...\RuntimeLibraries\Net2.x\LinqSupportClasses\LLBLGenProProvider2.cs: line 180 SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression) in ...\RuntimeLibraries\Net2.x\LinqSupportClasses\LLBLGenProProviderBase.cs: line 261 SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression) in ...\RuntimeLibraries\Net2.x\LinqSupportClasses\LLBLGenProProviderBase.cs: line 93 SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression) in ...\RuntimeLibraries\Net2.x\LinqSupportClasses\LLBLGenProProviderBase.cs: line 669 System.Linq.Queryable.Any[TSource](IQueryable1 source) AW.Tests.NormalTests.LinqWhereAndAny() in ...\AW Adpater\code\Tests\NormalTests.cs: line 109

Debug Trace

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_L1].[CustomerID] AS [CustomerId], [LPA_L1].[TerritoryID] AS [TerritoryId], [LPA_L1].[AccountNumber], [LPA_L1].[CustomerType], [LPA_L1].[rowguid] AS [Rowguid], [LPA_L1].[ModifiedDate] FROM [AdventureWorks].[Sales].[Customer] [LPLA_1] WHERE ( ( [LPA_L1].[CustomerID] = @CustomerId1)) Parameter: @CustomerId1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 15758.

Method Exit: CreateSelectDQ Method Exit: CreateSubQuery Generated Sql query: Query: SELECT [LPA_L1].[CustomerId] FROM (SELECT [LPA_L1].[CustomerID] AS [CustomerId], [LPA_L1].[TerritoryID] AS [TerritoryId], [LPA_L1].[AccountNumber], [LPA_L1].[CustomerType], [LPA_L1].[rowguid] AS [Rowguid], [LPA_L1].[ModifiedDate] FROM [AdventureWorks].[Sales].[Customer] [LPLA_1] WHERE ( ( [LPA_L1].[CustomerID] = @CustomerId1))) [LPA_L1] Parameter: @CustomerId1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 15758.

Method Exit: CreateSelectDQ Method Exit: CreateSubQuery Generated Sql query: Query: SELECT TOP 1 CASE WHEN EXISTS (SELECT [LPA_L1].[CustomerId] FROM (SELECT [LPA_L1].[CustomerID] AS [CustomerId], [LPA_L1].[TerritoryID] AS [TerritoryId], [LPA_L1].[AccountNumber], [LPA_L1].[CustomerType], [LPA_L1].[rowguid] AS [Rowguid], [LPA_L1].[ModifiedDate] FROM [AdventureWorks].[Sales].[Customer] [LPLA_1] WHERE ( ( [LPA_L1].[CustomerID] = @CustomerId1))) [LPA_L1]) THEN 1 ELSE 0 END AS [LPFA_1] FROM [AdventureWorks].[Sales].[Customer] [LPLA_1] Parameter: @CustomerId1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 15758.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging.

We will look into it.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 29-Jul-2009 12:50:17   

Indeed, seems to be a bug.

Workaround: bool exists = metaData.Customer.Any(c=>c.CustomerId==15758 );

So i.o.w.: you can move the filter of the where into the Any() call to avoid this issue for now.

Will work on a fix for this.

Frans Bouma | Lead developer LLBLGen Pro
SLE
User
Posts: 7
Joined: 27-Jul-2009
# Posted on: 29-Jul-2009 13:43:03   

OK, thanks simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 29-Jul-2009 14:51:12   

Fixed in attached build

Frans Bouma | Lead developer LLBLGen Pro