Bug #109997 MySql.Data.dll can't add user-defined type object
Submitted: 9 Feb 2023 5:39 Modified: 9 Feb 2023 9:56
Reporter: 超 刘 Email Updates:
Status: Analyzing Impact on me:
None 
Category:MySQL Connectors: Document Store: DevAPI Severity:S3 (Non-critical)
Version:8.0.32 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: C#, DevAPI

[9 Feb 2023 5:39] 超 刘
Description:
When I use method "public AddStatement Add(params object[] items)" in class "MySqlX.XDevAPI.Collection",to add data,I can only add anonymous type objects,but can't add user-defined type objects.

I guess maybe there is a bug in class "MySqlX.XDevAPI.DbDoc",
method "private Dictionary<string, object> ParseObject(object val)" ,
code "type.GetProperties(BindingFlags.Public)",
it can't get any properties.

How to repeat:
            var mySession = MySQLX.GetSession("server=localhost;port=33060;user=user;password=user;");

            var myDb = mySession.GetSchema("testDocStor");

            var myColl = myDb.CreateCollection("collection1");

            var datas = new List<object>();
            datas.Add(new User { _id = 14, Name = "Lili", Age = 18 });
            datas.Add(new User { _id = 15, Name = "Lala", Age = 19 });
            myColl.Add(datas.ToArray()).Execute();

    /// <summary>
    /// user
    /// </summary>
    public class User
    {
        public int _id { get; set; }
        public string Name { get; set; }
        public int Age { get; set; }
    }