Ambiguous reference for EntityCollection

Posts   
 
    
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 11-Oct-2006 23:14:51   

LLBLGen: 2.0 Final (Oct 3rd, 2006) Template Group:Adapter, 1 Class Template Bindings (in order of precedence): SqlServerSpecific.NET20 SharedTemplates.NET20 SharedTemplates.BackwardsCompatibility.NET20 Database: SQLServer 2000

Compile Error:

Error   1   'EntityCollection' is an ambiguous reference between 'HLPUSD.QQest.DAL.HelperClasses.EntityCollection<HLPUSD.QQest.DAL.EntityClasses.EmpMainEntity>' and 'SD.LLBLGen.Pro.ORMSupportClasses.EntityCollection<HLPUSD.QQest.DAL.EntityClasses.EmpMainEntity>'  C:\Documents and Settings\NJDeVore\My Documents\Visual Studio 2005\Projects\HLPUSD.QQest.BL\EmployeeManager.cs  37  16  HLPUSD.QQest.BL

I understand what this error means, but I'm at a loss as to how to resolve it. Obviously, the top of my class looks like this for my usings:

using HLPUSD.QQest.DAL;
using HLPUSD.QQest.DAL.HelperClasses;
using HLPUSD.QQest.DAL.EntityClasses;
using HLPUSD.QQest.DAL.FactoryClasses;
using HLPUSD.QQest.DAL.DatabaseSpecific;
using SD.LLBLGen.Pro.ORMSupportClasses;

...and then here's an example of a function that won't compile:

public EntityCollection<EmpMainEntity> GetAllEmployees()
        {
            EntityCollection<EmpMainEntity> empList = new EntityCollection<EmpMainEntity>(new EmpMainEntityFactory());

            IRelationPredicateBucket empFilter = new RelationPredicateBucket();
            empFilter.PredicateExpression.Add(EmpMainFields.ActiveYn == 1);
            if (_departmentFilter.Length > 0)
                empFilter.PredicateExpression.AddWithAnd(new FieldCompareSetPredicate(EmpMainFields.DepartmentId,null,TblDepartmentFields.DepartmentId,null, SetOperator.In,(TblDepartmentFields.DepartmentId == _departmentFilter | TblDepartmentFields.ParentId == _departmentFilter)));
            IPrefetchPath2 empPrefetch = new PrefetchPath2((int)EntityType.EmpMainEntity);
            empPrefetch.Add(EmpMainEntity.PrefetchPathTimeWorkingPunch).Filter.Add(TimeWorkingPunchFields.InpunchDt == DateTime.Today).AddWithAnd(TimeWorkingPunchFields.ActiveYn == 1);
            empPrefetch.Add(EmpMainEntity.PrefetchPathUserLogin).SubPath.Add(UserLoginEntity.PrefetchPathUserRequestAbsence ).Filter.Add(UserRequestAbsenceFields.AbsencestartDt >= DateTime.Today);
            empPrefetch.Add(EmpMainEntity.PrefetchPathEmpAbsenceUsed).Filter.Add(EmpAbsenceUsedFields.UsedDt >= DateTime.Today);

            using (DataAccessAdapter da = new DataAccessAdapter())
            {
                da.FetchEntityCollection(empList, empFilter, empPrefetch);
            }

            return empList;
        }

...now, as you can see I'm using the TblDepartmentFields to get at the field names, so I need to include the DAL.HelperClasses reference but also I need the ORMSupportClasses. Where am I going wrong?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 12-Oct-2006 02:55:26   

Someone else may be able to post more on why this is happening. Something to try until we have a good answer would be too use

SD.LLBLGen.Pro.ORMSupportClasses.EntityCollection<EmpMainEntity> empList = new SD.LLBLGen.Pro.ORMSupportClasses.EntityCollection<EmpMainEntity>(new EmpMainEntityFactory());

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 12-Oct-2006 09:35:31   

You have an old / beta runtime referenced which has the EntityCollection<T> class still in the runtime classes. With later runtimes (after beta) it's been placedin the generated code.

Could you check that please? (e.g. do you have the runtime libs in the GAC?)

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 12-Oct-2006 16:48:32   

That was it. I checked where the runtime was coming from and it was indeed the old version. Once updated to the most recent version, it compiled.

Thanks for the help!