Enterra.V8x1C.DOM.BaseObjectProperties.ConvertCustomPropertyValue C# (CSharp) Method

ConvertCustomPropertyValue() private method

private ConvertCustomPropertyValue ( string propName, object value ) : object
propName string
value object
return object
        private object ConvertCustomPropertyValue(string propName, object value)
        {
            if (!IsInternalV8Object(value))
            {
                return value;
            }

            MetadataObject metadataObject = null;

            if (!string.IsNullOrEmpty(ObjectTypeName))
            {
                if (this is BaseDocumentProperties)
                {
                    metadataObject = Session.Metadata.Documents[ObjectTypeName];
                }
                else if (this is BaseCatalogProperties)
                {
                    metadataObject = Session.Metadata.Catalogs[ObjectTypeName];
                }
            }

            if (metadataObject == null)
            {
                return ConvertV8Value(value);
            }

            if (metadataObject.HasRequisites)
            {
                var reqMeta = metadataObject.Requisites[propName];
                if (reqMeta != null)
                {
                    return ConvertV8Value(value, reqMeta.Type);
                }
            }
            if (metadataObject.HasTableParts)
            {
                var tablePartMeta = metadataObject.TableParts[propName];
                if (tablePartMeta != null)
                {
                    return new TablePart(Session, value);
                }
            }

            return value;
        }
    }