コード例 #1
0
        public async Task AddMany(List <Tabla> entityList)
        {
            var data  = new DataDummy();
            var table = data.DummyTable(entityList);

            using (var connection = Connection)
            {
                //connection.Open();
                await connection.ExecuteAsync("usp_InsertTvp", new { Records = table.AsTableValuedParameter("TvpRecords") }, commandType : CommandType.StoredProcedure);
            }
        }
コード例 #2
0
        public async Task AddMany(List <Tabla> entityList)
        {
            var data  = new DataDummy();
            var table = data.DummyTable(entityList);

            var param = new SqlParameter("@Records", table)
            {
                TypeName  = "TvpRecords",
                SqlDbType = SqlDbType.Structured
            };

            await _context.Database.ExecuteSqlRawAsync("exec usp_InsertTvp @Records", param);
        }