title: Is this an efficient way of bulk inserting using Dapper?
body: <p>Is this an efficient way of bulk inserting using Dapper?</p>
  <p>Also, is this more efficient than creating a stored procedure and passing models to it?</p>
  <p>Is this an efficient way of bulk inserting using Dapper?</p>
  <p>Also, is this more efficient than creating a stored procedure and passing models to it?</p>
  <pre><code>category = new Category
             {
                 Name = &quot;category&quot;,
                 Description = &quot;description&quot;,
                 Created = null,
                 LastModified = null,
                 CategoryPictures = new CategoryPicture[]
                 {
                      new CategoryPicture
                      {
                          CategoryId = 3,
                          PictureId = 2,
                          Picture = new Picture
                          {
                              Url = &quot;newUrl&quot;
                          }
                      },
                        new CategoryPicture
                      {
                          CategoryId = 3,
                          PictureId = 2,
                          Picture = new Picture
                          {
                              Url = &quot;url&quot;
                          }
                      }
                  }
              };
  
  string sql = @&quot;INSERT INTO Categories(Name, Description, Created, LastModified)
                 VALUES(@Name, @Description, @Created, @LastModified)&quot;;
  
  await conn.ExecuteAsync(sql, new
              {
                  category.Name,
                  category.Description,
                  category.Created,
                  category.LastModified
              });
  
  string catPicInsert = @&quot;INSERT INTO CategoryPictures(fk_CategoryId, fk_PictureId)
                          VALUES(@CategoryId, @PictureId)&quot;;
  
  await conn.ExecuteAsync(catPicInsert, category.CategoryPictures);
  
  string PicInsert = @&quot;INSERT INTO Pictures(Url)
                       VALUES(@Url)&quot;;
  
  await conn.ExecuteAsync(PicInsert, category.CategoryPictures.Select(x =&gt; x.Picture).ToList());
  </code></pre>