Пример #1
0
        public void Test1([DataSources] string context)
        {
            Query.ClearCaches();

            var ms = new MappingSchema();

            ms.SetConvertExpression <string?, CustomFieldType?>(s => CustomFieldType.FromString(s));
            ms.SetConvertExpression <CustomFieldType, DataParameter>(_ => new DataParameter(null, _ != null ? _.ToString() : null), false);

            using (var db = GetDataContext(context, ms))
                using (var tbl = db.CreateLocalTable <Issue1363Record>())
                {
                    db.Insert(new Issue1363CustomRecord2()
                    {
                        Id = 1
                    });

                    db.Insert(new Issue1363CustomRecord2()
                    {
                        Id     = 2,
                        Field1 = new CustomFieldType()
                    });

                    db.Insert(new Issue1363CustomRecord2()
                    {
                        Id     = 3,
                        Field1 = new CustomFieldType()
                        {
                            Field1 = "test"
                        }
                    });

                    Assert(db);
                }
        }