コード例 #1
0
        protected override SyncAttempt <IDataType> DeserializeCore(XElement node)
        {
            var name         = GetName(node);
            var alias        = GetAlias(node);
            var databaseType = GetDatabaseType(node);
            var folder       = GetFolder(node);

            if (alias != string.Empty)
            {
                alias = PropertyTypeHelper.GetUpdatedAlias(alias);
            }

            var infoNode = new XElement("Info");

            infoNode.Add(new XElement("Name", name));
            infoNode.Add(new XElement("EditorAlias", alias));
            infoNode.Add(new XElement("DatabaseType", databaseType));
            infoNode.Add(new XElement("Folder", folder));

            node.Add(infoNode);

            //Check if there is a custom convertor for this dataType
            var convertor = DataTypeConvertorFactory.GetConvertor(alias);

            if (convertor != null)
            {
                var config = convertor.GetConfig(node, alias);

                node.Add(new XElement("Config", new XCData(JsonConvert.SerializeObject(config, Formatting.Indented))));
            }

            node.Add(new XAttribute("Alias", name));

            return(base.DeserializeCore(node));
        }
コード例 #2
0
 public void IsViewModel_Success()
 {
     Assert.IsTrue(PropertyTypeHelper.IsViewModel(typeof(EmployeeVM)));
 }
コード例 #3
0
        private XElement CreateContentType(XElement node)
        {
            var infoNode = GetInfoNode(node);

            var keyAttr = GetKeyAttribute(node);

            if (keyAttr.Equals(Guid.Empty))
            {
                var key   = GetKey(infoNode);
                var alias = GetAlias(infoNode);

                node.Add(new XAttribute("Key", key));
                node.Add(new XAttribute("Alias", alias));
            }

            var hasVortoProperties = false;
            var propertiesNode     = GetPropertiesNode(node);

            if (propertiesNode != null)
            {
                var properties = propertiesNode.Elements("GenericProperty");

                foreach (var property in properties)
                {
                    var propertyType = GetPropertyType(property);

                    if (propertyType != string.Empty)
                    {
                        propertyType = PropertyTypeHelper.GetUpdatedAlias(propertyType);

                        if (VortoHelper.IsVortoType(propertyType))
                        {
                            var propertyDefinition = GetPropertyDefinition(property);
                            var vortoDataType      = VortoHelper.GetDataType(propertyDefinition);
                            if (vortoDataType != null)
                            {
                                propertyType = vortoDataType.PropertyEditorAlias;
                                property.Element("Definition").SetValue(vortoDataType.Guid);

                                hasVortoProperties = true;
                                property.Add(new XElement("Variations", "Culture"));
                            }
                        }
                    }

                    property.Element("Type").SetValue(propertyType);
                }
            }

            if (hasVortoProperties)
            {
                infoNode.Add(new XElement("Variations", "Culture"));
            }

            //Rename Structure/DocumentType to Structure/ContentType
            var structureNode = GetStructureNode(node);

            if (structureNode != null)
            {
                foreach (var docTypeNode in structureNode.Elements("DocumentType"))
                {
                    docTypeNode.Name = "ContentType";
                }
            }

            return(node);
        }
コード例 #4
0
 public void IsViewModelCollection_Success()
 {
     Assert.IsTrue(PropertyTypeHelper.IsViewModelCollection(typeof(VMCollection <EmployeeVM>)));
 }