I am reading microsoft online document about SSAS AMO.Net programming, stuck by the following pieces of code. I couldn't find any explanation about "Annotations" attribute. what is it? what is the purpose to have it set?
part = mg.Partitions.Add("Internet_Sales_549");
part.StorageMode = StorageMode.Molap;
part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey > '184' AND OrderDateKey <= '549'");
part.Slice = "[Date].[Calendar Year].&[2002]";
part.Annotations.Add("LastOrderDateKey", "549");
The documentation for the Partition class is here, but there's no mention of Annotations.
An Annotation can be added to most objects. It serves no functional purpose. However it can be extremely helpful when interfacing with custom code like yours. For example if your code needs to delete any partitions older than 3 years ago is it safer to parse the Internet_Sales_549
partition name or safer to look at the Annotation? It’s also a great way to distinguish computer generated partitions from manually created partitions.
I have used it in the past to add custom metadata to the cube which my automation code can interpret. For example I might tag the Internet Sales measure group with a PartitionStrategy=Weekly annotation while setting a PartitionStrategy=Monthly annotation on the Inventory measure group. I do this with a free extension to Visual Studio called BI Developer Extensions Show Extra Properties feature which makes Annotations editable in Visual Studio. Then my custom code looks for that annotation and creates the proper partitions without having to adjust a config file.