Migrate code from 2.6 to 3.5: Method GetAllRelations()

Posts   
 
    
SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 18-Oct-2012 15:07:52   

Hi,

We are migrating our O/R Mapper from 2.6 to 3.5. After the generated files are made succesfully we get serveral errors in our code.

private static IEntityRelation GetFKRelationByFieldname(CommonEntityBase manySideEntity, string relatedEnityPropertyName)
        {
            List<IEntityRelation> relations = manySideEntity.GetAllRelations();
            foreach (IEntityRelation relation in relations)
            {
                if (relation.MappedFieldName == relatedEnityPropertyName)
                {
                    return relation;
                }
            }

            return null;
        }

The GetAllRelations() method is now protected instead of public so we can't enumerate through the collection of relations.

Can you tell me what the recommended way is to do this?

Thanks, Sander.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 19-Oct-2012 09:33:39   

Cast the entity to IEntityCore as the interface is now explicitly implemented in the IEntityCore interface to remove it from the public interface of the class.

Frans Bouma | Lead developer LLBLGen Pro
SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 19-Oct-2012 09:34:31   

Thanks, it works!