Class ProfileDefinition
Represents a Profile Manager profile definition.
[Serializable]
public class ProfileDefinition : DocumentBase, IManagerIdentifiableObject<Guid>, CustomDataType, DataType, ITrackLastModified
- Inheritance
-
ProfileDefinition
- Implements
-
IManagerIdentifiableObject<Guid>
- Inherited Members
- Extension Methods
Examples
Creating, retrieving, updating and deleting a profile definition.
using System;
using System.Linq;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net.Messages.SLDataGateway;
using Skyline.DataMiner.Net.Profiles;
public class Script
{
ProfileHelper helper;
public void Run(Engine engine)
{
helper = new ProfileHelper(engine.SendSLNetMessages);
var profileDefinition = CreateprofileDefinition();
profileDefinition = RetrieveProfileDefinition(profileDefinition.ID);
profileDefinition = UpdateProfileDefinition(profileDefinition);
profileDefinition = DeleteProfileDefinition(profileDefinition.ID);
}
private ProfileDefinition DeleteProfileDefinition(Guid iD)
{
var profileDefinition = RetrieveProfileDefinition(iD);
helper.ProfileDefinitions.Delete(profileDefinition);
return profileDefinition;
}
private ProfileDefinition UpdateProfileDefinition(ProfileDefinition profileDefinition)
{
profileDefinition.Description = "Another Description";
profileDefinition.Parameters.Add(CreateParameter()); // Created a new parameter linked to the ProfileDefinition (same method as in Profile Parameter code sample)
return helper.ProfileDefinitions.Update(profileDefinition);
}
private ProfileDefinition RetrieveProfileDefinition(Guid iD)
{
var filter = ProfileDefinitionExposers.ID.Equal(iD);
var profileDefinition = helper.ProfileDefinitions.Read(filter).FirstOrDefault();
return profileDefinition;
}
private ProfileDefinition CreateProfileDefinition()
{
ProfileDefinition def = new ProfileDefinition();
//def.BasedOn.Add(...) ProfileDefinition can be based upon another ProfileDefinition (inheritance)
def.Description = "Description";
def.Name = "Name";
def.Parameters.Add(CreateParameter()); // Created a new parameter linked to the ProfileDefinition (same method as in Profile Parameter code sample)
def.Scripts = new ScriptEntry[]
{
new ScriptEntry()
{
Description = "Script Description",
Name = "Script Name",
Script = "Script:ScriptToRun|||||"
}
};
return helper.ProfileDefinitions.Create(def);
}
}
Constructors
- ProfileDefinition()
Initializes a new instance of the ProfileDefinition class.
- ProfileDefinition(ProfileDefinition)
Initializes a new instance of the ProfileDefinition class using the specified profile definition.
- ProfileDefinition(Guid)
Initializes a new instance of the ProfileDefinition class using the specified GUID.
Properties
- BasedOn
Gets the profile definitions this profile definition is based on.
- BasedOnIDs
Gets the IDs of the profile definitions this profile definition is based on.
- ID
Gets or sets the ID of this profile definition.
- ParameterIDs
Gets or sets the IDs of the parameters that are part of this profile definition.
- Parameters
Gets the parameters that are part of this profile definition.
- ProfileDefinitionId
Gets or sets the profile definition ID.
- Scripts
Gets or sets the scripts used by this profile definition.
- ServiceProfileDefinitionID
Gets or sets the service profile definition ID.
- TableDefinitions
Gets or sets the table definitions.
Methods
- FiltersTo(ProfileDefinition)
Retrieves a value indicating whether this profile definition matches the specified filter.
- FromXml(string)
Returns an instance of this class from the specified XML representation.
- GetAncestralSet()
Retrieves all the ancestors, in top-to-bottom order (i.e. the current profile definition "this" is the last item in the returned object).
- GetHashCode()
Calculates the hash code for this object.
- GetInconsistentBasedOnIDs()
Retrieves the inconsistent basedOn IDs.
- GetInconsistentParameterIDs()
Retrieves the inconsistent parameter IDs.
- HasCyclicDependency()
Returns a value indicating whether there is a cyclic dependency.
- HasRecursiveInheritance(ref HashSet<Guid>)
Returns a value indicating whether there is recursive inheritance.
- IsConsistent()
Returns a value indicating whether it is consistent.
- ShouldSerializeBasedOnIDs()
Returns a value indicating whether the basedOn IDs should be serialized.
- ShouldSerializeParameterIDs()
Returns a value indicating whether the parameter IDs should be serialized.
- ToString()
Returns a string that represents the current object.
- ToXml()
Returns an XML representation of this object.