public void TestExportImportXml()
        {
            var tUser     = Tables.User();
            var tCustomer = Tables.Customer();

            var selectExpr = Select(tUser.UserId, tUser.FirstName, tCustomer.CustomerId, Cast(Literal(12.8m), SqlType.Decimal(new DecimalPrecisionScale(10, 2))).As("Salary"))
                             .From(tUser)
                             .InnerJoin(tCustomer, on: tCustomer.UserId == tUser.UserId)
                             .Where(tUser.Version == 5 & tUser.RegDate > new DateTime(2020, 10, 18, 1, 2, 3, 400) & tUser.RegDate <= new DateTime(2021, 01, 01))
                             .OrderBy(tUser.FirstName)
                             .OffsetFetch(100, 5)
                             .Done();

            var sb = new StringBuilder();

            using XmlWriter writer = XmlWriter.Create(sb);
            selectExpr.SyntaxTree().ExportToXml(writer);

            var doc = new XmlDocument();

            doc.LoadXml(sb.ToString());

            var res = ExprDeserializer.DeserializeFormXml(doc.DocumentElement !);

            Assert.AreEqual(selectExpr.ToSql(), res.ToSql());
        }
 public static ExprCast LiteralCast(decimal value, DecimalPrecisionScale?precisionScale = null) => Cast(Literal(value), SqlType.Decimal(precisionScale));
        public void TestExportImportPlain()
        {
            var tUser     = Tables.User();
            var tCustomer = Tables.Customer();

            var selectExpr = Select(tUser.UserId, tUser.FirstName, tCustomer.CustomerId, Cast(Literal(12.8m), SqlType.Decimal(new DecimalPrecisionScale(10, 2))).As("Salary"))
                             .From(tUser)
                             .InnerJoin(tCustomer, on: tCustomer.UserId == tUser.UserId)
                             .Where(tUser.Version == 5 & tUser.RegDate > new DateTime(2020, 10, 18, 1, 2, 3, 400) & tUser.RegDate <= new DateTime(2021, 01, 01))
                             .OrderBy(tUser.FirstName)
                             .OffsetFetch(100, 5)
                             .Done();


            var items = selectExpr.SyntaxTree().ExportToPlainList(PlainItem.Create);

            var res = ExprDeserializer.DeserializeFormPlainList(items);

            Assert.AreEqual(selectExpr.ToSql(), res.ToSql());
        }