Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: tmtm on August 26, 2009, 03:13:26 am

Title: IDualRepository.GetDiagramByGuid return type
Post by: tmtm on August 26, 2009, 03:13:26 am
Is there any reason why IDualRepository.GetDiagramByGuid returns a result of type "object" instead of "EA.Diagram"?

All of the other IDualRepository.Get__ByGuid and IDualRepository.Get__ByID methods return their expected types. For example, IDualRepository.GetElementByGuid returns an "EA.Element" object.

Can the result be something other than of type "EA.Diagram"?

Thank you.
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: Geert Bellekens on August 26, 2009, 04:35:08 pm
According to the documentation it should return a Diagram.
Quote
GetDiagramByGuid (string Guid)
 Diagram
 Returns a pointer to a diagram using the global reference ID (global ID). This is usually found using the diagram GUID property of an element, and stored for later use to open an diagram without using the collection GetAt() function.

Parameters:

Guid: String - the GUID of the diagram to locate.  
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: Geert Bellekens on August 26, 2009, 04:56:50 pm
Checked it on the latest version (848) and indeed the operation returns an object iso a Diagram.
You better report this as a bug.

Geert
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: Paolo F Cantoni on August 27, 2009, 01:52:35 pm
Quote
Checked it on the latest version (848) and indeed the operation returns an object iso a Diagram.
You better report this as a bug.

Geert
As a matter of course we cast the return to an EA.Diagram, so the actual object reutrned is the "correct" diagram, but as Geert says, it's a bug...
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: «Midnight» on August 28, 2009, 10:05:49 pm
The cautionary step Paolo uses is great for antibugging of course. But the way EA behaves is contrary to both the documentation and other similar operations. That's just plain wrong.
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: tmtm on September 04, 2009, 05:35:54 am
Thanks everyone. I've reported this as a bug. Not critical or anything. But it's good to have consistency.
Title: Re: IDualRepository.GetDiagramByGuid return type
Post by: Ribeye on October 14, 2023, 09:04:01 pm
As At 2023-10-14 I am seeing this bug in the latest version.

My question is how to do the casting from object to diagram? When I use

            Diagram diagramDynamic = (Diagram) repository.GetDiagramByGuid(testDiagramGUID);

I get Visual Studio saying

     Error   CS0656   Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.Convert'