Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Sean Gifford on July 11, 2014, 03:51:53 am
-
For example, given a class "Detail", and another class "Master" where Master has an attribute that is an IEnumerable<Detail>, how do I actually represent that?
Right now, I'm overriding the attribute type with a value I'm typing in, but obviously I don't have the correct connections by doing this.
Thanks!
-
I'm not sure which context you are talking about. But to define types there is usually an ellipsis button right to the input field. There you can choose the right classifier. Just typing it will not result in the right matching.
q.
-
I might be missing something fundamental here.
But if I create a new type that is IEnumerable<Detail>, that doesn't really connect the Master class to Detail. IEnumerable<Detail> being just a list of Detail.
-
Are you by any chance talking about the API? Maybe you should note the steps you take.
q.
-
No, I'm talking about simple C# class definitions in a class diagram. Being able to define attributes or operation parameters on the class to equivalents to C# generic types, like IEnumerable<T>, IDictionary<K,T>, etc. all while maintaining the expected connections.
-
I think I'm closer to a solution, and perhaps this will make what I'm asking clearer.
I have my two sample classes setup, and I've now tried making the Details attribute on Master a Detail type, but whose details are that it's a collection of 0..* multiplicity using a container of type IEnumerable<T>. It looks like this (http://1drv.ms/1rZaf7i)
(http://1drv.ms/1rZaf7i)
This at least succeeds in linking the two elements together, and one understands looking at the result what the intention is. But it still isn't correct, because when I attempt to generate code I get this:
///////////////////////////////////////////////////////////
// Master.cs
// Implementation of the Class Master
// Generated by Enterprise Architect
// Created on: 10-Jul-2014 2:00:12 PM
// Original author:
///////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
public class Master {
private Detail IEnumerable<T> Details;
private int Id;
public Master(){
}
~Master(){
}
public virtual void Dispose(){
}
}//end Master
where
private Detail IEnumerable<T> Details;
should be
private IEnumerable<Detail> Details;
I also tried using the IEnumerable<#TYPE#> syntax with no improvement.
EA11, btw
Hope that this makes it clearer. I'm sure this is just my lacking in some EA fundamentals....