Book a Demo

Author Topic: Mass Update of TaggedValues in C#  (Read 3203 times)

thakur1203

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Mass Update of TaggedValues in C#
« on: December 29, 2016, 07:43:50 pm »
Hi,

I am trying to add multiple tagged values in Repository. But Update method is taking lot of time and causing slowness. So don't want to update tagged values one by one but in one go using update only once. Please see code below and suggest.

EA.Element element;
Testcase testcase;

foreach (var entity in testcase.TagValList)
{
  EA.TaggedValue tag = element.TaggedValues.AddNew(entity.Property, entity.Value);
  tag.Name = entity.Property;
  tag.Value = entity.Value;
  tag.Notes = entity.Notes;
  tag.Update();
}
« Last Edit: December 29, 2016, 07:49:03 pm by thakur1203 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Mass Update of TaggedValues in C#
« Reply #1 on: December 29, 2016, 09:20:17 pm »
You can omit
Code: [Select]
  tag.Name = entity.Property;
  tag.Value = entity.Value;
since the AddNew already sets them. But basically that's all you can do.

If you really, really want, you can create the tagged values directly in the table t_objectproperties. You need to invent your own guids in that case. And it will not work for grouped MDG TVs.

q.