Commandment 7: Use Package Spec Instead of Dependency Elements within Spec

The PackageSpec spec type describes a set of specs to be deployed together as a package. The main element within the PackageSpec is DependencyList that is used to list the catalog items (specs) that should be created or updated prior to adding or updating the catalog item. The DependencyList element holds a list of Dependency child elements. Each Dependency child element refers to a catalog item (spec).

<PackageSpec
       XMLns="bb_appfx_package"
       XMLns:common="bb_appfx_commontypes"
       ID="6AC5B1BE-6266-4F8D-8BFE-3979BA0B6EC0"
       Name="Widget Package"
       Description="Used to deploy the widget SDK sample."
       Author="SDK Author"
       >
 
       <common:DependencyList>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetCategoryCode.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetDepartmentCode.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetVendorCode.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.Widget.Table.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetPart.Table.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetExpense.Table.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetBatch.Table.XML"/>
 
<common:Dependency CatalogAssembly="Widget.Catalog.dll" CatalogItem="Widget.Catalog.WidgetExpenseBatch.Table.XML"/>

So what does "deployed together as a package" mean? While the LoadSpec utility is a great way to load and test individual specs in the Infinity database, we need a way to deploy a bunch of specs in a controlled fashion. With Infinity development, a catalog is an assembly (.dll file) that contains embedded catalog items (specs) as resources.

This way, when we compile/build our project, Visual Studio will actually embed our resource (XML spec files) into the compiled assembly (.dll file). An administrator of the application will copy the catalog assemblies that you develop to the Infinity application's ...\bbappfx\vroot\bin\customfolder. After the catalog assembly is in its proper place, the administrator can load the assembly using the Catalog Browser. System administrators use the Catalog Browserpage to manage the installation of catalog items and new features. Using the Catalog Browser, administrators can determine when they will load new features — promptly after updating, at a later date, or not at all. When an administrator loads your assembly, the catalog browser will look inside your assembly and find the PackageSpec. It then runs through the list of Dependency elements within the PackageSpec from the top down. For each Dependency element, it will attempt to load each XML file referenced. The order of Dependency elements is important. CodeTableSpecs typically go first, followed by TableSpecs, etc.

Blackbaud recommends using the package spec to load specs together as a group instead of using dependency elements within the individual specs. Package specs control the order in which related specs are loaded.