How can I pass a strongly typed EntityCollection to a generic function?, e.g. to centralize use of Adapter specific code.
the following code generates this error at compile time.
Error 1 The best overloaded method match for 'MyAppDataModule.DataService.FetchCollection(ref MyAppDB.HelperClasses.EntityCollection<SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2>, SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket)' has some invalid arguments C:\Code\MyApp2\MyDataModule\DataServices.cs 27 4 MyAppDataModule
Consider the following code:
public EntityCollection<AffiliationEntity> GetAffiliates()
{
EntityCollection<AffiliationEntity> ec = new EntityCollection<AffiliationEntity>();
this.FetchCollection(ec, null);
return ec;
}
private void FetchCollection(ref EntityCollection<EntityBase2> ec, IRelationPredicateBucket bucket)
{
using (IDataAccessAdapter adapter = this.GetAdapter())
{
adapter.FetchEntityCollection(ec, bucket);
}
}
public IDataAccessAdapter GetAdapter()
{
IDataAccessAdapter adapter = new MyAppDB.DatabaseSpecific.DataAccessAdapter();
return adapter;
}