I am using the latest version (2.6.09.0511), just downloaded, updated and verified in my references et al.
I get the following error message when I try to save an entity. The error is happening during the refetch on a specific entity type a few levels down in the entity hierarchy.
Message:
An exception was caught during the execution of a retrieval query: An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name. . Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
Stack Trace:
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PerformExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, CommandBehavior behavior)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFields2 fieldsToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfos, IRelationPredicateBucket filter)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PersistQueue(List`1 queueToPersist, Boolean insertActions, Int32& totalAmountSaved)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave)
at Chevron.Completions.BLL.BLManager.Save() in D:\HappyCoders\Clients\ChevronTexaco\Subversion\Completions\VisualStudio\Chevron.Completions.BLL\BLManager.cs:line 1210
Query:
Query: SELECT [Completions].[dbo].[WorkstringSections].[CompletionJobID], [Completions].[dbo].[WorkstringSections].[TopDepth], [Completions].[dbo].[WorkstringSections].[WorkstringLength], [Completions].[dbo].[WorkstringSections].[TubularID], [Completions].[dbo].[WorkstringSections].[MetallurgyID], [].[Metallurgy] FROM [Completions].[dbo].[WorkstringSections] WHERE ( ( [Completions].[dbo].[WorkstringSections].[CompletionJobID] = @CompletionJobID1 AND [Completions].[dbo].[WorkstringSections].[TopDepth] = @TopDepth2))
Parameter: @CompletionJobID1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 14a12cf1-f152-4d08-8918-ee6a0da72b63.
Parameter: @TopDepth2 : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 0.
As you can see, the problem is in the select, on the column "[].[Metallurgy] " which is missing an alias it would seem.
I have an entity called WorkstringSectionEntity. A WorkstringSectionEntity has a MetallurgyID int field, foreign key to the Metallurgies table. I prefetch the MetallurgyEntity into the WorkstringSectionEntity on opening and creating a new WorkstringSectionEntity.
The field in question is actually a "field on related field" from the MetallurgyEntity.Metallurgy field, which is a string field of the same name on the WorkstringSectionEntity.
If I put a record manually in the database, the entity fetches fine and the field WorkstringSectionEntity.Metallurgy returns the correct string every time.
However, as soon as I make a change to the data in the WorkstringSectionEntity I added to the database manually, I get the error again.
I might mention that I have another related entity that is exposes 8 "field on related field" to the WorkstringSectionEntity and these don't seem to be aproblem. They certainly don't show up in the query. I just didn't think the field that's having the problem from the Metallurgies table should be in there, since these type of fields are returned directly from the related entity.
The error seemed to come out of nowhere. I haven't regenerated the data layer in months and just not sure what could be the root cause of this.