I am using Lightspeed v4.0.1632.21637 (nightly 16 Oct 2012) on the Nortwind database. I try to join two tables, one of them called "Orders":
var results = from details in unitOfWork.OrderDetails
join order in unitOfWork.Orders on details.OrderId equals order.Id
select new { order.Id };
I get the following exception:
Test method Northwind.Tests.LightspeedTest.TestOrderColumn threw exception:
System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Order'.
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()
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()
at ...()
at Mindscape.LightSpeed.Profiling.Interceptor.ExecuteCommand(Func`1 baseExecutor, IUnitOfWork unitOfWork, IDbCommand command)
at ..(IUnitOfWork , IDbCommand , Func`1 )
at ..(IUnitOfWork , IDbCommand )
at Mindscape.LightSpeed.Data.DataProviderAdapter.(IUnitOfWork , , ProviderOptions )
at ..(Query )
at Mindscape.LightSpeed.UnitOfWork.Project(Query query)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ProjectManyNative(IUnitOfWork unitOfWork)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteImmediate(IUnitOfWork unitOfWork, Type returnType)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Northwind.Tests.LightspeedTest.TestOrderColumn() in LightspeedTest.cs: line 102