protected void PostSetCustomProperties()
        {
            ListProperties.AddRange(Properties.Values.ToList());
            fieldNameLookup = new Dictionary <string, int>(Properties.Count, StringComparer.Ordinal);

            setModified = new bool[ListProperties.Count];

            if (firstStringProperty == null)
            {
                firstStringProperty = ListProperties.Find(prop => prop.BasicType == BasicType.Text &&
                                                          !prop.IsPrimaryKey);
            }

            names = Properties.Keys.ToArray();
            for (int i = 0; i < Properties.Count; i++)
            {
                PropertyDefinition prop = Properties.ElementAt(i).Value;

                fieldNameLookup[names[i]] = i;
                setModified[i]            = prop.SetModified;

                if (prop.IsPrimaryKey)
                {
                    PrimaryKeys.Add(i);
                }

                prop.Index = i;

                if (prop.Type == PropertyInputType.select)
                {
                    prop.DefaultSearch = "0";
                }
            }

            PrimaryKeyIsOneInt = PrimaryKeys.Count == 1 &&
                                 ListProperties[PrimaryKeys[0]].DataType == typeof(Int32);
            PrimaryKeyIsOneLong = PrimaryKeys.Count == 1 &&
                                  ListProperties[PrimaryKeys[0]].DataType == typeof(Int64);
            PrimaryKeyIsOneGuid = PrimaryKeys.Count == 1 &&
                                  ListProperties[PrimaryKeys[0]].DataType == typeof(Guid);

            PrimaryKeyFieldName = PrimaryKeys.Count == 1 ?
                                  ListProperties[PrimaryKeys[0]].FieldName : null;
        }