I'm dumping the schema from the table into a Tag Annotation for the package.
<Annotation AnnotationType="Tag" Tag="PackageSchema">
<#=Table.Schema#>
</Annotation>
In the BIML for creating a master package I'm creating a sequence container for each schema and putting the packages in the corresponding container. At least that's what I'm asking it to do.
<Package Name="01-Master" ConstraintMode="Linear">
<Tasks>
<# foreach (var SchemaNode in RootNode.Schemas) { #>
<Container Name="SEQC <#=SchemaNode.Name#>" ConstraintMode = "Parallel">
<Tasks>
<# foreach (var Pckg in RootNode.Packages.Where(pkgschema => pkgschema.GetTag("PackageSchema")==SchemaNode.Name)) { #>
<ExecutePackage Name="EP <#=Pckg.Name#>" DelayValidation="true">
<ExternalProjectPackage Package="<#=Pckg.Name#>.dtsx">
</ExternalProjectPackage>
</ExecutePackage>
<# } #>
</Tasks>
</Container>
<# } #>
</Tasks>
When that runs I get a Master package with empty sequence containers. I took the where out of the package foreach, and it generates but puts all packages in every container. I put the GetTag in the name of the package just to make sure it picked it up correctly.
<# foreach (var Pckg in RootNode.Packages) { #>
<ExecutePackage Name="EP <#=Pckg.Name#>" DelayValidation="true">
<ExternalProjectPackage Package="<#=Pckg.Name#>.dtsx--<#=Pckg.GetTag("PackageSchema")#>--<#=SchemaNode.Name#>">
The tag was put into the package name but it is padded with lots of space around it.
<ExecutePackage Name="EP Application_TransactionTypes" DelayValidation="true">
<ExternalProjectPackage Package="Application_TransactionTypes.dtsx-- Application --Application" />
</ExecutePackage>
<ExecutePackage Name="EP Purchasing_PurchaseOrderLines" DelayValidation="true">
<ExternalProjectPackage Package="Purchasing_PurchaseOrderLines.dtsx-- Purchasing --Application" />
</ExecutePackage>
So I'm guessing that the padded value is why the RootNode.Packages.Where is not matching up to the schema name. I can't figure out how to trim off the spaces though. I tried putting a trim() in different places but the BIML engine complains about it. I was able to get rid of the leading spaces by taking the tabs out in front of the actual annotation in the BIML but it still pads the end.
Any ideas on why the tag is getting padded, or maybe I'm completely off base here and it's not the spaces around the tag.