Not able to create EntityFields2, in DynamicRelation

Posts   
 
    
Posts: 25
Joined: 16-Jul-2007
# Posted on: 22-Apr-2009 07:19:10   

Hi,

I'm trying to create a dynamic relation, like same way you have explained in your example. Here is my code

          ResultsetFields EntityFields2 = new ResultsetFields(3);
                    EntityFields2.DefineField(EntityItemFields.EntityId, 0);
                    EntityFields2.DefineField(MetaDataFields.FieldId, 1);
                    EntityFields2.DefineField(MetaDataFields.MetaDataId, 2);

                    IPredicateExpression metdataFilter = new PredicateExpression(MetaDataFields.TaxonomyId == taxonomyId);
                    metdataFilter.AddWithAnd(MetaDataFields.FieldId == Constants.AVERAGE_ALLOCATION_SCORE_FIELDID);
                    metdataFilter.AddWithAnd(MetaDataFields.MetaDataId == EntityItemFields.MetaDataId);

                    DerivedTableDefinition metaTable = new DerivedTableDefinition(EntityFields2, "EI", metdataFilter);

                    HIA.BM.DAL.RelationClasses.DynamicRelation relation = new HIA.BM.DAL.RelationClasses.DynamicRelation(
                        metaTable, JoinHint.Left, HIA.BM.DAL.EntityType.EntitySetEntity, "ES",
                        (new EntityFields2(EntityItemFieldIndex.EntityId.ToString(), "EI", typeof(string)) == EntitySetFields.EntityId.SetObjectAlias("ES")));


My environment: VS IDE 2008, LLBLGEN version 2.6 latest build (2.6.09.0327)

But for some reason i'm getting following issues in compile time.



The best overloaded method match for 'HIA.BM.DAL.RelationClasses.DynamicRelation.DynamicRelation(SD.LLBLGen.Pro.ORMSupportClasses.DerivedTableDefinition, SD.LLBLGen.Pro.ORMSupportClasses.JoinHint, HIA.BM.DAL.EntityType, string, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate)' has some invalid arguments    C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  306 75  HIA.BM.BL

Argument '5': cannot convert from 'bool' to 'SD.LLBLGen.Pro.ORMSupportClasses.IPredicate'   C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  308 26  HIA.BM.BL
The best overloaded method match for 'SD.LLBLGen.Pro.ORMSupportClasses.EntityFields2.EntityFields2(int, SD.LLBLGen.Pro.ORMSupportClasses.IInheritanceInfoProvider, System.Collections.Generic.Dictionary<string,int>)' has some invalid arguments   C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  308 26  HIA.BM.BL

Argument '1': cannot convert from 'string' to 'int' C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  308 44  HIA.BM.BL

Argument '2': cannot convert from 'string' to 'SD.LLBLGen.Pro.ORMSupportClasses.IInheritanceInfoProvider'   C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  308 86  HIA.BM.BL

Argument '3': cannot convert from 'System.Type' to 'System.Collections.Generic.Dictionary<string,int>'  C:\NextGen\BL\CollectionClasses\EntitySetCollection.cs  308 92  HIA.BM.BL 

Please advise me how to proceed?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 22-Apr-2009 10:18:23   

ResultsetFields EntityFields2 = new ResultsetFields(3);

EntityFields2 is a class name, please don't use it as the name of your ResultsetFields object. This will cause an ambiguity when used later on.

Posts: 25
Joined: 16-Jul-2007
# Posted on: 22-Apr-2009 11:39:02   

Hi,

Thanks for your quick reply, i have changed my code as per your comment, still am getting the same issues.

One thing that, i couldn't see any overload constructor which takes string as first parameter for EntityFields2 class.

Is am missing any libraries?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 22-Apr-2009 11:52:26   

You have mis-read the code example in the docs.

It should be EntityField (for SelfServicing) or EntityField2 (for Adapter), not an EntityFields. There should be no 's' at the end.

Posts: 25
Joined: 16-Jul-2007
# Posted on: 22-Apr-2009 12:42:29   

Hi, Many thanks. I have changed to EntityField2. Now it works well.