EntityBase2 BeginEdit() method

Posts   
 
    
Posts: 64
Joined: 30-Aug-2010
# Posted on: 08-Sep-2010 15:30:42   

Hello

When trying to compile my project, i get the following error at this line of code:

 if (m_BindingManager.Current is EntityBase2) ((EntityBase2)m_BindingManager.Current).BeginEdit(); 

This used to work fine, but I currently migrated the project from .Net Framework 1 to .Net Framework 3, and so from LLBLGen v1 to LLBLGen v3.

Do you have any idea on how this has to be changed? Thank you

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 08-Sep-2010 16:18:24   

You haven't mentioned the error. simple_smile

Posts: 64
Joined: 30-Aug-2010
# Posted on: 08-Sep-2010 16:37:58   

Sorry, I forgot to mention it.

So, the error message was:

'SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2' does not contain a definition for 'BeginEdit' and no extension method 'BeginEdit' accepting a first argument of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2' could be found (are you missing a using directive or an assembly reference?) D:\ASTech2\astech.office\trunk\ListFormManager.cs 2978 90 ASTech.Office

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Sep-2010 09:53:07   

As BeginEdit is a member of the interface 'IEditableObject' we've implemented it explicitly to free up the public api in intellisense.

So cast to IEditableObject instead of EntityBase2

Frans Bouma | Lead developer LLBLGen Pro
bjacobs
User
Posts: 73
Joined: 20-Aug-2008
# Posted on: 12-Feb-2012 17:16:42   

I rely on BeginEdit, EndEdit, and CancelEdit for my editor dialogs. Would the following be a workable solution to give me backwards compatibility from 3.1 to 2.6 so that 1. I do not have to cast. 2. Interfaces that I have created which have these methods as part of their interface do not have to be re-worked.

In the CommonEntityBase class:

// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode public void BeginEdit() { ((IEditableObject)this).BeginEdit(); } public void EndEdit() { ((IEditableObject)this).EndEdit(); } public void CancelEdit() { ((IEditableObject)this).CancelEdit(); }

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 13-Feb-2012 10:26:07   

Seems fine, I encourage you to test it, to see if it goes smoothly or not.

Posts: 36
Joined: 02-May-2012
# Posted on: 02-May-2012 21:57:09   

Walaa wrote:

Seems fine, I encourage you to test it, to see if it goes smoothly or not.

Just upgrading from 2.6 to 3.1...when I try the code above, with these methods or other properties, it goes into an infinite loop/stack overflow exception.

    public void BeginEdit()
    {
        ((IEditableObject)this).BeginEdit();
    }

Any suggestions, other than adding casts all over...?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-May-2012 07:23:52   

I don't see why would you obtain an stackoverflow. Please post more information: - LLBLGen runtime library version (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725) - Full exception message and stack trace - Relevant code. i.e. Where are you putting that code and how are you calling it.

David Elizondo | LLBLGen Support Team