<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>Bulk Copy Insert</Title>
      <Shortcut>blk</Shortcut>
      <Description>Skeleton for creating bulk insert method</Description>
      <Author>Mike Cofoed</Author>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>FunctionName</ID>
          <ToolTip>
          </ToolTip>
          <Default>FunctionName</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>TableType</ID>
          <ToolTip>
          </ToolTip>
          <Default>TableType</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>DestinationTable</ID>
          <ToolTip>
          </ToolTip>
          <Default>DestinationTable</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>BatchSize</ID>
          <ToolTip>
          </ToolTip>
          <Default>1000</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>Timeout</ID>
          <ToolTip>
          </ToolTip>
          <Default>600</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>BulkCopy</ID>
          <ToolTip>
          </ToolTip>
          <Default>BulkCopy</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[/// <summary>
///
/// </summary>
/// <param name="tbl"></param>
public void $FunctionName$($TableType$ tbl) {
	if (tbl == null) { throw new ArgumentNullException("tbl"); }
	using (SqlBulkCopy $BulkCopy$ = new SqlBulkCopy(this.ConnectionString, SqlBulkCopyOptions.Default)) {
		$BulkCopy$.DestinationTableName = "$DestinationTable$";
		$BulkCopy$.BatchSize = $BatchSize$;
		$BulkCopy$.BulkCopyTimeout = $Timeout$;
		foreach (DataColumn col in tbl.Columns) {
			$BulkCopy$.ColumnMappings.Add(col.ColumnName, col.Caption);
		}
		$BulkCopy$.WriteToServer(tbl);
	}
}]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>