Esempio n. 1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var columnSet = new ConfigColumnSet();

            while (reader.Read())
            {
                switch (reader.TokenType)
                {
                case JsonToken.EndObject:
                    return(columnSet);

                case JsonToken.PropertyName:
                    var columnName = (string)reader.Value;
                    reader.Read();
                    var column = serializer.Deserialize <ConfigColumn>(reader);
                    column.name = columnName;
                    columnSet.Add(column);
                    break;
                }
            }

            return(columnSet);
        }
 private static List <string> GetColumns(ConfigColumnSet ConfigColumnSet)
 {
     return(ConfigColumnSet.Select(column => column.name + " " + column.type + " " + (column.primaryKey | !column.allowNull ? " NOT NULL " : " NULL"))
            .ToList());
 }
 private static List <string> GetPrimaryKeys(ConfigColumnSet ConfigColumnSet)
 {
     return((from column in ConfigColumnSet
             where column.primaryKey
             select column.name).ToList());
 }