locked
Error when loading a saved diagram - Element with ID de55ebdf-0ba8-4baa-aa03-9d15985d27a4 already exists in element directory. RRS feed

  • Question

  • I have a DSL that allows a user to design an object model that later gets generated with T4 to c# classes. The DSL has a Domain Class called BusinessBase. BusinessBase has an embedding relationship to itself called ParentChild which allows you to create child relationships of the same BusinessBase type. This part works well and I even have the T4 for that working.

    The problem comes in when I inherit from BusinessBase. I have a Domain Class called ReadOnlyList. The idea is that a user can drag a ReadOnlyList onto the designer and then drag a BusinessBase on to the designer and use a connector which I call ListOf Connector. This in effect shows a List<T> where the List is a ReadOnlyList and T is a BusinessBase. It all saves jsut fine, but if I try to close and open the designer file, I get the error:

     Element with ID de55ebdf-0ba8-4baa-aa03-9d15985d27a4 already exists in element directory.

    I unserstand why I am getting this error (the Guid for my BusinessBase is listed twice in the XML of the designer). Here is my designer file's xml (notice the 'de55....' guid listed twice):

    <?xml version="1.0" encoding="utf-8"?>
    <prismCslaModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="c216fad2-998f-48c2-b626-1bfcb15d9a3f" xmlns="http://schemas.microsoft.com/dsltools/PrismCslaDsl">
     <prismCslaModelEntities>
      <readOnlyList Id="87a49b26-d0f8-4394-ac3c-943717074a27" name="MyList" isChild="false">
       <readOnlyListOfBusinessBase>
        <businessBase Id="de55ebdf-0ba8-4baa-aa03-9d15985d27a4" name="MyInfo" isChild="false" />
       </readOnlyListOfBusinessBase>
      </readOnlyList>
      <businessBase Id="de55ebdf-0ba8-4baa-aa03-9d15985d27a4" name="MyInfo" isChild="false" />
     </prismCslaModelEntities>
    </prismCslaModel>
    

    I see the issue, but I dont know how to prevent this from happening? Have I created my DSL incorrectly?

    Here is a screenshot of my DSL: ScreenShot

    Any ideas?

    Thanks,

    -Jeff

    Tuesday, July 27, 2010 7:59 PM

Answers

  • Hi Jeff,

    The reason you have this problem is because you have two embedding relations and the same element is embedded twice - once under root and the other time within the list. Does it make sense to change the relation from embedding to reference this will allow you to have businessBase under model root that you can refer to them from the list.

    Eyal Lantzman [MSFT]

    • Proposed as answer by EyalLantzman Wednesday, July 28, 2010 9:00 AM
    • Marked as answer by Savij Wednesday, July 28, 2010 3:07 PM
    Wednesday, July 28, 2010 9:00 AM

All replies

  • Hi Jeff,

    The reason you have this problem is because you have two embedding relations and the same element is embedded twice - once under root and the other time within the list. Does it make sense to change the relation from embedding to reference this will allow you to have businessBase under model root that you can refer to them from the list.

    Eyal Lantzman [MSFT]

    • Proposed as answer by EyalLantzman Wednesday, July 28, 2010 9:00 AM
    • Marked as answer by Savij Wednesday, July 28, 2010 3:07 PM
    Wednesday, July 28, 2010 9:00 AM
  • I didnt realize the difference between the two types of references. Worked like a charm!

    Thanks for the help!

    -Jeff

    Wednesday, July 28, 2010 3:09 PM