jagadeesh.macherla

AFSDK Performance Issue

Discussion created by jagadeesh.macherla on Sep 14, 2012
Latest reply on Sep 19, 2012 by pkaiser

    Normal   0           false   false   false     EN-US   X-NONE   X-NONE                                                                                                                                                                                                                                                                                                                                                      

 

Hi Team,

 

 

 

We are facing performance issue while fetching an information AFSDK. Its’ taking lot of time. Please find sample code-snippet as shown below :-

 

 

 

 

 
//Find Elements
AFNamedCollectionList objAFElementCollection= AFElement.FindElements(this.Database, searchRoot, elementTemplateName, AFSearchField.Template, true, AFSortField.Name, this.Order, maxCount);

 
//Traverse afcollection list
Parallel.ForEach(afCollectionList, objAFElement =>
                {
                            Name = objAFElement.Name,
                            Description = objAFElement.Description,
                            Path = objAFElement.GetPath(),
                            Template = objAFElement.Template != null ? objAFElement.Template.Name : null,
                            //ParentElement = GetElementParents(objAFElement),
                            Attributes = GetAttributeValue(objAFElement, this.AttributeType)
               });

 
//Function to get attribute values

Private void  GetAttributeValue(AFElement objafelement, string attributeType)

        {

              List lstAttribute = new List();
              lstAttribute = attributes.AsParallel().AsOrdered().Select(objAttribute => new attribute()
                    {
                        Attributes = objAttribute.Attributes.Count > 0 ? GetChildAttributeValues(objAttribute.Attributes) : null,
                        Name = objAttribute.Name,
                        Value = Convert.ToString(values[attributes.IndexOf(objAttribute)].Value),
                        Settings = objAttribute.DataReference != null ? objAttribute.RawPIPointPath(AFEncodeType.Name) : null
                    }).ToList();
     }
 

Could you please tell us what happening wrong here or how we can improve the performance?

 

 

Thanks in Advance!!!

 

 

Outcomes