I’m trying to upgrade some of our projects from 4.0.40 to the latest in nuget (4.5.6).
Some of my unit tests rely on text[]
columns in the PostgreSql data source, which are working fine on the old version, but do not seem to deserialize correctly anymore on the new version. Instead of an array of the values in the column, I get an array with a single value equal to System.String[]
. The following is a sample program to reproduce the issue:
namespace OrmTest
{
using System;
using ServiceStack.DataAnnotations;
using ServiceStack.OrmLite;
using ServiceStack.Text;
public class MyData
{
[PrimaryKey]
public Guid Id { get; set; }
[CustomField("int[]")]
public int[] MyInts { get; set; }
[CustomField("text[]")]
public string[] MyStrings { get; set; }
}
class MainClass
{
public static void Main(string[] args)
{
var factory = new OrmLiteConnectionFactory("Host=localhost;Username=ormtest;Database=ormtest;Port=5432;", PostgreSqlDialect.Provider);
using(var db = factory.OpenDbConnection())
{
db.CreateTableIfNotExists<MyData>();
var newdata = new MyData
{
Id = Guid.NewGuid(),
MyInts = new[] { 2, 4, 1 },
MyStrings = new[] { "test string 1", "test string 2" }
};
db.Save(newdata);
var datas = db.Select<MyData>().ToArray();
datas.PrintDump();
}
}
}
}
The output shows that the int[]
field is working as expected, but the text[]
field no longer does:
[
{
Id: ec05c19d04dc43e0b0f562ff9c43a122,
MyInts:
[
2,
4,
1
],
MyStrings:
[
"System.String[
]"
]
}
]
Is there something wrong or missing in my code that needs to be fixed to get the text[]
columns working again?
edit: I should note that the insert seems to work correctly, as when I manually check the data in PostgreSql it has the correct string array value in the my_strings
column as expected.