model view with same name generate Argument Exception

Posts   
 
    
Jan VBM avatar
Jan VBM
User
Posts: 24
Joined: 03-Apr-2011
# Posted on: 03-Apr-2011 14:03:31   

In the LLBLGenPro Designer v3.1 I'm allowed to have two model views with the same name (e.g. "Test") and when I try to reopen the "llblgenproj" file, it generates an ArgumentException "An item with the same key has already been added" as attached below. It took me some time to discover the correlation between the two.

Shouldn't non-unique identification of model views (or other objects for that matter) be disabled?

regards Jan

Exception information.

LLBLGen Pro version: v3.1. Build: February 7th, 2011

Exception details:

Message: An item with the same key has already been added. Source: mscorlib Stack trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable1 source, Func`2 keySelector) at SD.LLBLGen.Pro.ApplicationCore.EntityModel.ModelViews.ModelViewList.DeserializeLayoutInformation(XmlReader reader, Project containingProject) at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.DeserializeLayoutInformation(XmlReader reader) at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.Load(String filename, String additionalTypeConverterFolder) at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformOpenProjectAction(String filenameToOpen)

Inner exception: <null>

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Apr-2011 20:02:09   

I reproduce it. It's no admitted to have the same name on Model Views. It should be a check when you create one.

We will look into it. In the meantime, as you can't open your project, open it in a notepad, then browse your model views and rename one:

  <ModelViews>
    <ModelView Name="Xyz">
      <EntityDefinitions>
        <Entity Name=":Customer" />
        <Entity Name=":Order" />
      </EntityDefinitions>
      <Documentation><![CDATA[]]></Documentation>
    </ModelView>
    <ModelView Name="Xyz">
      <EntityDefinitions>
        <Entity Name=":Product" />
        <Entity Name=":Region" />
        <Entity Name=":Shipper" />
      </EntityDefinitions>
      <Documentation><![CDATA[]]></Documentation>
    </ModelView>

then save and reopen your project. We will look into this.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-Apr-2011 08:52:58   

Ah, I see where the issue is. Normally, one creates a modelview by selecting the entities, then specifying the modelview, and if you specify an existing one, it will add the entities to that modelview. Creating a new one uses a different codepath for creating the modelview. We'll add a check there, it's an oversight.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-Apr-2011 09:46:10   

Fixed in next build.

Frans Bouma | Lead developer LLBLGen Pro
Jan VBM avatar
Jan VBM
User
Posts: 24
Joined: 03-Apr-2011
# Posted on: 04-Apr-2011 10:11:31   

Excellent, thanks!

Kind regards, Med venlig hilsen, Saludos cordiales, Met vriendelijke groeten,

Jan