Closed alecava58 closed 5 years ago
I solved creating a new AttributeCollection and add the new AttributeCollection to routerDb.EdgeMeta collection. Then I create a new EdgeData object and update the EdgeData. This way works but there are a lot of new EdgeMeta objects all with the same attributes collection. How I can reuse the EdgeMeta ids with the same attributes collection?
`
while (edgeEnumerator.MoveNext())
{
var edge = routerDb.Network.GetEdge(edgeEnumerator.Id);
var metaData = routerDb.EdgeMeta.Get(edge.Data.MetaId);
IAttributeCollection newMetaData = new AttributeCollection();
foreach (var a in metaData)
newMetaData.AddOrReplace(a.Key, a.Value);
newMetaData.AddOrReplace("custom", "5000");
var newMetaId = routerDb.EdgeMeta.Add(newMetaData);
var newEdgeData = new EdgeData { Distance = edge.Data.Distance, Profile = edge.Data.Profile, MetaId = newMetaId };
routerDb.Network.UpdateEdgeData(edgeEnumerator.Id, newEdgeData);
}
`
Solved using EdgeProfiles collection.
I'm trying to add an edge meta data value but I get and exception "Collection is readonly". May be I make mistake, what is the right way to add a meta data value to one or more edges?
following my snippet: