LLBLGen Data Source Control

Posts   
 
    
Posts: 254
Joined: 16-Nov-2006
# Posted on: 27-Nov-2006 17:44:10   

Guys,

I'm trying to use the data source control using code such as

    suppliersDataSource.DataContainerType = DataSourceDataContainerType.EntityCollection;
    suppliersDataSource.EntityCollection = suppliers;

Presumably this is all I need to create the data source and then use it to bind to a control such as GridView. However when I do this I get a compilation error

C:\Documents and Settings\MADA\My Documents\Visual Studio 2005\WebSites\TestLLBGen\Default.aspx.cs(35,48 ): error CS0266: Cannot implicitly convert type 'BottomLine.SprinterNet.CollectionClasses.SupplierCollection' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollection2'. An explicit conversion exists (are you missing a cast?)

If I review the generated code for SupplierCollection

[Serializable]
public partial class SupplierCollection : EntityCollectionBase<SupplierEntity>

and then the definition for EntityCollectionBase is

// Summary:
//   Implementation of the entity collection base class.
[Serializable]
public abstract class EntityCollectionBase<TEntity> : CollectionCore<TEntity>, IEntityCollection, IEnumerable, ITransactionalElement, IXmlSerializable, IListSource, SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollectionAccess, SD.LLBLGen.Pro.ORMSupportClasses.ICollectionMaintenance where TEntity : SD.LLBLGen.Pro.ORMSupportClasses.EntityBase, SD.LLBLGen.Pro.ORMSupportClasses.IEntity

You can see it only implements IEntityCollection and not IEntityCollection2

Any ideas how I can progress this?

Cheers

Matt

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 28-Nov-2006 02:30:48   

You should use LLBLGenDataSource not LLBLGenDataSource2. The 2 version is there for adapter and it appears that you are using self servicing.

Self Servicing collections implement IEntityCollection.