public MetadataProperty CreateProperty(ApplicationObject owner, string name, SqlFieldInfo field)
        {
            MetadataProperty property = new MetadataProperty()
            {
                Name     = name,
                DbName   = field.COLUMN_NAME,
                FileName = Guid.Empty,
                Purpose  = PropertyPurpose.System
            };

            SetupPropertyType(owner, property, field);
            return(property);
        }
        private void SetupPropertyType(ApplicationObject owner, MetadataProperty property, SqlFieldInfo field)
        {
            // TODO: учесть именования типов PostgreSQL, например (mchar, mvarchar)

            if (field.DATA_TYPE == "nvarchar")
            {
                property.PropertyType.CanBeString = true;
            }
            else if (field.DATA_TYPE == "numeric")
            {
                property.PropertyType.CanBeNumeric = true;
            }
            else if (field.DATA_TYPE == "timestamp")
            {
                property.PropertyType.IsBinary = true;
            }
            else if (field.DATA_TYPE == "binary")
            {
                if (field.CHARACTER_MAXIMUM_LENGTH == 1)
                {
                    property.PropertyType.CanBeBoolean = true;
                }
                else if (field.CHARACTER_MAXIMUM_LENGTH == 16)
                {
                    if (field.COLUMN_NAME.ToLowerInvariant().TrimStart('_') == "idrref")
                    {
                        property.PropertyType.IsUuid = true;
                    }
                    else
                    {
                        property.PropertyType.CanBeReference = true;
                        if (owner is TablePart)
                        {
                            property.PropertyType.ReferenceTypeCode = ((TablePart)owner).Owner.TypeCode;
                        }
                        else
                        {
                            property.PropertyType.ReferenceTypeCode = owner.TypeCode;
                        }
                    }
                }
            }
        }