EntityView - What's wrong with this code?

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 12-May-2010 12:55:12   

I am trying to create an EntityView and it will not compile.



EntityCollection phoneCollection= new EntityCollection(new TelephoneAllValidViewEntityFactory());

filter.Add(TelephoneAllValidViewFields.PartyId == partyId);
bucket.PredicateExpression.Add(filter);

using (DataAccessAdapter adapter = new DataAccessAdapter())
{
       adapter.FetchEntityCollection(phoneCollection, bucket);
}

EntityView2<TelephoneAllValidViewEntity> view = new EntityView2<TelephoneAllValidViewEntity>(phoneCollection);


Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 12-May-2010 14:16:12   

Please post the compilation error.

jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 12-May-2010 15:25:25   

The compiler shows these error messages. I have replaced the project namespace for security reasons.

Error 50 The best overloaded method match for 'SD.LLBLGen.Pro.ORMSupportClasses.EntityView2<MyProjectName.DAL.EntityClasses. TelephoneAllValidViewEntity>.EntityView2(SD.LLBLGen.Pro.ORMSupportClasses. EntityCollectionBase2<MyProjectName.DAL.EntityClasses.TelephoneAllValidViewEntity>)' has some invalid arguments

Error 51 Argument '1': cannot convert from 'MyProjectName.DAL.HelperClasses.EntityCollection' to 'SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2<MyProjectName.DAL.EntityClasses.TelephoneAllValidViewEntity>'

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 12-May-2010 15:32:02   

Please try the following instead:

EntityCollection<TelephoneAllValidViewEntity> phoneCollection= new EntityCollection<TelephoneAllValidViewEntity>();

filter.Add(TelephoneAllValidViewFields.PartyId == partyId);
bucket.PredicateExpression.Add(filter);

using (DataAccessAdapter adapter = new DataAccessAdapter())
{
     adapter.FetchEntityCollection(phoneCollection, bucket);
}

EntityView2<TelephoneAllValidViewEntity> view = new EntityView2<TelephoneAllValidViewEntity>(phoneCollection);