Upgrade from LLblgen1.0 to 3.0 Issue

Posts   
 
    
Leo Wang
User
Posts: 29
Joined: 29-Jul-2010
# Posted on: 20-Oct-2010 10:28:42   

Error Message: cannot convert from 'Quotit.DAL.CachedDroppedPlanGroupFieldIndex' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField2'

How to rewrite following codes for fields.DefineField function? fields.DefineField((CachedDroppedPlanGroupFieldIndex)enumeration, i++, ((CachedDroppedPlanGroupFieldIndex)enumeration).ToString());

Source code:


foreach(Enum enumeration in Enum.GetValues(typeof(CachedDroppedPlanGroupFieldIndex)))
{
  if((CachedDroppedPlanGroupFieldIndex)enumeration != CachedDroppedPlanGroupFieldIndex.AmountOfFields)
  {
      fields.DefineField((CachedDroppedPlanGroupFieldIndex)enumeration, i++, ((CachedDroppedPlanGroupFieldIndex)enumeration).ToString());
  }
}

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 20-Oct-2010 10:58:50   

As the exception says DefineField() accepts IEntityField or IEntityField2 as the first parameter.

You can try the following:

var i = 0;

foreach(var field in myEntity.Fields)
{
    fields.DefineField(field, i++);
}
Leo Wang
User
Posts: 29
Joined: 29-Jul-2010
# Posted on: 03-Nov-2010 10:15:16   

thank you. works for us