<#@ template language="C#" #>
<#@ import namespace="System.Data" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <!-- Creates a connection to the Adventure Works database -->
        <Connection
            Name="AdventureWorks"
            ConnectionString="Provider=SQLNCLI10.1;Data Source=Localhost;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=AdventureWorksDW" 
            />
    </Connections>
    <!-- Packages Collection -->
    <Packages>
        <!-- A Package -->
        <Package
            Name="MyFirstPackage"
            ConstraintMode="Linear"
            >
            <!-- A Package's Tasks -->
            <Tasks>
                <ExecuteSQL Name="ExecuteStoredProc" ConnectionName="AdventureWorks">
                    <DirectInput>EXEC usp_StoredProc</DirectInput>
                </ExecuteSQL>
                <# foreach (var table in RootNode.Tables) { #>
                    <Dataflow Name="Duplicate <#=table.Name#> Data">
                        <Transformations>
                            <OleDbSource Name="Retrieve Data" ConnectionName="AdventureWorks">
                                <DirectInput>SELECT * FROM <#=table.Name#></DirectInput>
                            </OleDbSource>
                            <OleDbDestination Name="Insert Data" ConnectionName="AdventureWorks">
                                <ExternalTableOutput Table="<#=table.Name#>" />
                            </OleDbDestination>
                        </Transformations>
                    </Dataflow>
                <# } #>
            </Tasks>
        </Package>
    </Packages>
</Biml>
