ICustomAttributeServiceSaveCustomAttribute Method |
Save a custom attribute.
Namespace: Dundas.BI.AccountServicesAssembly: Dundas.BI.Core (in Dundas.BI.Core.dll) Version: 2.0.0.0 (26.2.0.1000)
Syntaxvoid SaveCustomAttribute(
CustomAttributeInfo attributeInfo
)
Sub SaveCustomAttribute (
attributeInfo As CustomAttributeInfo
)
void SaveCustomAttribute(
CustomAttributeInfo^ attributeInfo
)
abstract SaveCustomAttribute :
attributeInfo : CustomAttributeInfo -> unit Parameters
- attributeInfo CustomAttributeInfo
- The custom attribute object to be saved.
Exceptions
Remarks
For new custom attribute, the
Id property of the provided
custom attribute object will be updated.
Example
This example demonstrates how to create the Dundas BI engine, start the Dundas BI engine, log on, create a custom attribute called Daves, assign that custom attribute to the Dave accounts, and then shutdown the Dundas BI engine.
using Dundas.BI;
using Dundas.BI.AccountServices;
using Dundas.BI.Services;
using System.Collections.ObjectModel;
...
EngineManager.CreateEngine(
@"C:\Program Files\Dundas Data Visualization Inc\Dundas BI\Instances\Instance1\www\BIWebsite\App_Data"
);
try
{
EngineManager.StartEngine();
using(Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null))
{
LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
"admin",
"1234",
true,
null
);
Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(
logOnResult.Session.Id
);
ICustomAttributeService customAttributeService =
Engine.Current.GetService<ICustomAttributeService>();
customAttributeService.SaveCustomAttribute(
new CustomAttributeInfo()
{
Description = "These are the Daves I know",
Name = "Daves",
InheritanceBehavior = CustomAttributeInheritanceBehavior.Override,
IsMultiValue = false
}
);
var davesCustomAttribute = customAttributeService.GetCustomAttribute("Daves");
IAccountService accountService =
Engine.Current.GetService<IAccountService>();
AccountQueryFilterRule accountQueryFilterRule =
new AccountQueryFilterRule(
AccountQueryField.DisplayName,
Dundas.BI.QueryFilterOperator.StartsWith,
"dav"
);
IList<Account> daveAccounts =
accountService.AccountQuery(
0,
0,
null,
new List<AccountQueryFilterRule>() {
accountQueryFilterRule
}
);
foreach(Account daveAccount in daveAccounts)
{
daveAccount.CustomAttributes.Add(
davesCustomAttribute.Id, new CustomAttributeValue(davesCustomAttribute.Id) { SingleValue = "Is a Dave I know" }
);
accountService.SaveAccount(daveAccount);
}
}
}
finally
{
EngineManager.ShutdownEngine();
}
See Also