If you get an exception like:
System.Web.HttpUnhandledException (0x80004005): Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —> SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: The multi-part identifier "MyDatabase.dbo.User.Name" could not be bound..
make sure you use corresponding EntityFactory and Fields:
EntityCollection items = new EntityCollection(new UserEntityFactory()); PredicateExpression filter = new PredicateExpression(Userields.Name == username); IRelationPredicateBucket bucket = new RelationPredicateBucket(); bucket.PredicateExpression.AddWithAnd(filter); using (var adapter = ConnectionHelper.GetAdapter(Source.LocatiePlatform, _logger)) { adapter.FetchEntityCollection(items, bucket); adapter.CloseConnection(); }
In the code above if you change the UserEntityFactory to an other “table factory” like PersonEntityFactory, you will get the 0x80004005 exception.