Exemplo n.º 1
0
        public static void TestExtractToArrays()
        {
            var extractor  = new FieldExtract <C, object>(new[] { "a", "b", "s" });
            var results    = extractor.Extract(c1);
            var extracted  = FieldExtractUtil.ExtractToObjectArrays(extractor, new[] { c1, c2, c1, c2 });
            var serialized = JsonConvert.SerializeObject(extracted);

            Assert.AreEqual(serialized, @"[[100,100,100,100],[12,12,12,12],[""one"",""two"",""one"",""two""]]");
        }
Exemplo n.º 2
0
        public IReadOnlyList <BulkInsertInstructions> BuildInstructionsForRows(IReadOnlyList <TEntity> rows)
        {
            var objs         = FieldExtractUtil.ExtractToObjectArrays(FieldExtractor, rows);
            var instructions = new BulkInsertInstructions[Properties.Count];

            for (var i = 0; i < Properties.Count; i++)
            {
                var prop = Properties[i];
                instructions[i] = new BulkInsertInstructions
                {
                    DbParamType   = prop.RecommendedDbType,
                    ParameterName = prop.ParameterNameInQuery,
                    Values        = objs[i]
                };
            }
            return(instructions);
        }