Table joins will slow down feature updating.

92
0
04-27-2020 04:41 PM
FayuLai
New Contributor II

Updating data to a feature class will be slow when there are some tables joined to it.  The following is the function we used to update the data.  The performances on a feature class with table joined and without table joined are very different.  We are able to duplicate this issue in 2.3, 2.4 and 2.5.

        private async Task<bool> UpdateType(FeatureLayer pFeatLyr, List<long> oidSet, string sType)

        {

            var op = new EditOperation();

            FeatureClass pFeatCls = await CHaLayerSrv.GetFeatureClass(pFeatLyr);

            //FeatureClass pFeatCls = ((FeatureLayer)pFeatLyr).GetFeatureClass();

            try

            {

                op.Callback(async context =>

                {

                    StringBuilder sb = new StringBuilder();

                    sb.Append("OBJECTID IN(");

                    foreach (long objId in oidSet)

                    {

                        sb.Append(objId.ToString() + ",");

                    }

                    sb.Remove(sb.Length - 1, 1).Append(")");   

                    string query = sb.ToString();

                    using (RowCursor pFeatCur = await CHaMapSelection.SearchFeatures(pFeatCls, query, "", false))

                    {

                        while (pFeatCur != null && pFeatCur.MoveNext())

                        {

                            using (Feature pFeat = (Feature)pFeatCur.Current)

                            {

                                context.Invalidate(pFeat);

                                pFeat[GlobalConst.SHAPE_TITLE_TYPE] = sType;

                                pFeat.Store();

                                context.Invalidate(pFeat);

                            }

                        }

                    }

                }, pFeatCls);

 

                if (!op.Execute())

                {

                    Console.WriteLine(op.ErrorMessage);

                    return false;

                }

                else

                {

                    return true;

                }

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

 

                return false;

            }

            finally

            {

                if (pFeatCls != null)

                {

                    pFeatCls.Dispose();

                    pFeatCls = null;

                }

            }

        }

We have reported similar issue before.  But we are still not able to solve this problem.  Any help will be greatly appreciated.

0 Kudos
0 Replies