private PropertyTypeItem BuildPropertyTypeItem(PropertyType propertyType)
 {
     var propertyTypeItem = new PropertyTypeItem();
     propertyTypeItem.Alias = propertyType.Alias;
     propertyTypeItem.Description = propertyType.Description;
     propertyTypeItem.Id = propertyType.Id;
     propertyTypeItem.Name = propertyType.Name;
     propertyTypeItem.TypeId = GetDataTypeDefinitionId(propertyType);
     return propertyTypeItem;
 }
示例#2
0
        private DataGridTypeItem CreateDataGridTypeItem(PropertyTypeItem propType, string className)
        {
            if (propType.DataType.PreValueItems.Count > 1)
            {
                var dataGridTypeItem = new DataGridTypeItem();
                dataGridTypeItem.Id = propType.Id;
                dataGridTypeItem.TypeId = propType.TypeId;
                dataGridTypeItem.ClassName = className;
                dataGridTypeItem.IdentifierName = Naming.PascalCase(Naming.IdentifierName(propType.DataType.DataTypeName));

                foreach (var preValue in propType.DataType.PreValueItems.Skip(1))
                {
                    var column = new DataGridTypeItem.Column();
                    var json = new JavaScriptSerializer();
                    var dictionary = json.Deserialize<Dictionary<string, object>>(preValue.Value);
                    if (dictionary.ContainsKey("Alias"))
                    {
                        column.Alias = dictionary["Alias"] as string;
                        column.IdentifierName = Naming.PropertyName(column.Alias, className);
                    }
                    if (dictionary.ContainsKey("DataTypeId"))
                    {
                        int typeId = DataTypeHelper.GetValueTypeId(column.Alias);
                        if (typeId == 0)
                        {
                            column.DataType = TypeLib.DataTypes.FirstOrDefault(dt => dt.Id == (int)dictionary["DataTypeId"]);
                        }
                        else
                        {
                            column.DataType = TypeLib.DataTypes.FirstOrDefault(dt => dt.Id == typeId);
                            column.DataType.Type = column.DataType.ModelType;
                        }
                    }
                    dataGridTypeItem.Columns.Add(column);
                }
                return dataGridTypeItem;
            }
            return null;
        }
示例#3
0
        public bool IncludeProperty(PropertyTypeItem propertyType, string className)
        {
            if (string.IsNullOrEmpty(ExcludePropertyRegEx)) return true;

            string identifierName = this.PropertyName(propertyType, className);
            Regex regex = new Regex(ExcludePropertyRegEx, RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
            MatchCollection matchCollection = regex.Matches(identifierName);
            return matchCollection.Count == 0;
        }
示例#4
0
 public string PropertyName(PropertyTypeItem propertyType, string className)
 {
     return Naming.PropertyName(propertyType.Alias, className);
 }