GetDeleteList cast error when using inheritance

GetDeleteList cast error when using inheritance

Old forum URL:

terrycasper posted on Tuesday, February 09, 2010

I have an object model that emulates a table structure.  The model implements 3 specific types of tables, a code list, decision table and version control.  A table has columns and rows and a row has cells.  I have abstract base classes for table, column, row and cell and their lists.  Then I have concrete classes for each type of table.  without getting into every class in the inheritance tree, here is a short example:

Base classes

public abstract class Rows<TList, TEntity> : BusinessListBase<Rows<TList, TEntity>, Row<TEntity>>

where TList : Rows<TList, TEntity>

where TEntity : Row<TEntity>


public abstract class Row<TEntity> : PersistableItem<TEntity>, IRow where TEntity : AqsBusinessBase<TEntity>

public abstract class AqsBusinessBase<T> : BusinessBase<T>

where T : AqsBusinessBase<T>




public class DecisionTableRow : Row<DecisionTableRow>



public class DecisionTableRows : Rows<DecisionTableRows, DecisionTableRow>

Everything works fine.  All my factories work.  I can fetch data, create new data, edit data and persist the data to the DB.  Where I am experiencing an issue is in deleting from any list.  When I call GetDeletedList in my DecisontableRowsFactory,I get the following exception:

DataPortal.Update failed (System.InvalidCastException: Unable to cast object of type 'Csla.Core.MobileList`1[AQS.ProductDefinition.DomainCSLA.Repository.Business.Row`1[AQS.ProductDefinition.DomainCSLA.Repository.Business.DecisionTableRow]]' 

to type 'Csla.Core.MobileList`1[AQS.ProductDefinition.DomainCSLA.Repository.Business.DecisionTableRow]'.

   at Csla.Server.ObjectFactory.GetDeletedListCoffee(Object obj) in C:\Visual Studio 

The call is made as:

var deletedList = GetDeletedList<DecisionTableRow>(rows);

I thought I had all the template inheritance figured out but I am obviously missing something.  Anyone have any ideas?




terrycasper replied on Tuesday, February 09, 2010

Never mind.  Sorry to bother the forum, I have ti resolved.  Had to call GetDeletedList with the proper signature GetDeletedList<Row<DecisionTableRow>>(rows);


Copyright (c) Marimer LLC