Skip to main content
Version: 4.3.2

Model

Methods

GetMetadata

Retrieves the metadata of the model, including filters and views.

Definition

public static DRevealModelMetadata GetMetadata(MemoryStream modelStream)

Usage Example

[TestMethod]
public void GetModelMetadata()
{
string fileName = "Product Inventory.dModelX"; //Replace this variable with your model report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";

MemoryStream modelFile = GetStream(filePath);

var modelMetadata = InfoArch.Common.DataExtraction.Helper.DRevealModelHelper.GetMetadata(modelFile);
Assert.IsNotNull(modelMetadata, "The DRevealModelMetadata should not be null.");
}

GetMetadata (Overload)

Retrieves the metadata of the model, including columns and filters, using the specified client settings.

Definition

public static DRevealModelMetadata GetMetadata(MemoryStream modelStream, string connectionString, ICollection<Parameter.DRevealParameter> parameters)

Usage Example

private List<DRevealParameter> GetModelUserDefinedCultureParameter()
{
return new List<DRevealParameter>()
{
new DRevealParameter() { Name = "Culture", Value = "zh-CN", DataType = DataType.String }
};
}

[TestMethod]
public void GetModelMetadataOverloaded()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Product Inventory.dModelX"; //Replace this variable with your model report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";

MemoryStream modelFile = GetStream(filePath);

var modelMetadata = InfoArch.Common.DataExtraction.Helper.DRevealModelHelper.GetMetadata(modelFile, connectionString, GetModelUserDefinedCultureParameter());
Assert.IsNotNull(modelMetadata, "The DRevealModelMetadata should not be null.");
}