Author Topic: IDualRepository.GetDiagramByGuid return type  (Read 15210 times)

tmtm

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
IDualRepository.GetDiagramByGuid return type
« 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.
« Last Edit: August 26, 2009, 03:16:18 am by tmtm »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: IDualRepository.GetDiagramByGuid return type
« Reply #1 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.  

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: IDualRepository.GetDiagramByGuid return type
« Reply #2 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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: IDualRepository.GetDiagramByGuid return type
« Reply #3 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...
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: IDualRepository.GetDiagramByGuid return type
« Reply #4 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.
No, you can't have it!

tmtm

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: IDualRepository.GetDiagramByGuid return type
« Reply #5 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.

Ribeye

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: IDualRepository.GetDiagramByGuid return type
« Reply #6 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'