henkmollema/Dommel

Insert column with type of array

mbtolou opened this issue · 1 comments

Hi.
I create table with _varchar(string[]) type in Postgres .

[Table("tbl_profile_channel")]
public class ProfileChannelModel 
{
  #region Columns
  public long id { get; set; }
  public long channel_hash { get; set; }
  public string obis_code { get; set; }
  public long profile_group_hash { get; set; }
  public short lag_hour_jump { get; set; }
  public short query_date_days_ago { get; set; }
  public bool ctpt_scale { get; set; }
  public string[] cols_obis_list { get; set; }
}

when query this table data return successfully .
csharp var ta = AppConfig.GetPgqlConn().GetAll<DbEntity.Models.ProfileChannelModel>();

but when try insert data into . throw exception :

      AppConfig.GetPgqlConn().Insert(
        new DbEntity.Models.ProfileChannelModel
        {
          cols_obis_list = new string[] { "test", "next" },
          obis_code = "123",
          channel_hash = 120,
          lag_hour_jump = 5,
          query_date_days_ago = 5,
          ctpt_scale = true,
          profile_group_hash = 12
        });

when change my class property with array type to object ,both of query (Insert ,Update) work successfully.

[Table("tbl_profile_channel")]
public class ProfileChannelModel 
{
  #region Columns
  public long id { get; set; }
  public long channel_hash { get; set; }
  public string obis_code { get; set; }
  public long profile_group_hash { get; set; }
  public short lag_hour_jump { get; set; }
  public short query_date_days_ago { get; set; }
  public bool ctpt_scale { get; set; }
  public object cols_obis_list { get; set; }  // <======= this is changed from string[] to object
}

What exception does it throw?