Book a Demo

Author Topic: Re: Is there a way to flush stereotypeEx property  (Read 2555 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is there a way to flush stereotypeEx property
« on: July 22, 2011, 07:18:16 pm »
Vinay,

I don't think I had an issue with resetting the stereotype's on an element, but... there's always a backdoor.
If the API doesn't expose a certain feature, or it won't update it, you can use Repository.Execute to execute your own SQL update string to the database.
That backdoor allows you to do virtually anything, even if its not possible using the "regular" API methods.

Here's the code I use to manipulate the stereotypes on an element (don't forget to call update() as well)
Code: [Select]
       /// <summary>
        /// returns a list of all stereotypes
        /// </summary>
        /// <returns>a list of stereotypes</returns>
        public override List<string> stereotypes
        {
            get
            {
                List<string> stereotypeList = new List<string>();
                string stereotypes = wrappedElement.StereotypeEx;
                if (stereotypes != string.Empty)
                {
                    stereotypeList.AddRange(stereotypes.Split(new char[] { ',' }));
                }
                return stereotypeList;
            }
            set
            {
                this.wrappedElement.StereotypeEx = string.Join(",", value.ToArray());
            }
        }

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is there a way to flush stereotypeEx property
« Reply #1 on: July 23, 2011, 02:22:19 pm »
t_xref?

Geert