Class ProfileInstance
Represents a Profile Helper profile instance.
[Serializable]
public class ProfileInstance : DocumentBase, IManagerIdentifiableObject<Guid>, CustomDataType, DataType, ITrackLastModified
- Inheritance
-
ProfileInstance
- Implements
-
IManagerIdentifiableObject<Guid>
- Inherited Members
- Extension Methods
Examples
Creating, retrieving, updating and deleting a profile instance.
using System;
using System.Linq;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net.Messages.SLDataGateway;
using Skyline.DataMiner.Net.Profiles;
using Parameter = Skyline.DataMiner.Net.Profiles.Parameter;
public class Script
{
private ProfileHelper helper;
public void Run(Engine engine)
{
helper = new ProfileHelper(engine.SendSLNetMessages);
ProfileInstance pi = CreateProfileInstance();
pi = RetrieveProfileInstance(pi.ID);
pi = UpdateProfileInstance(pi);
pi = DeleteProfileInstance(pi.ID);
}
private ProfileInstance DeleteProfileInstance(Guid iD)
{
var profileInstance = RetrieveProfileInstance(iD);
helper.ProfileInstances.Delete(profileInstance);
return profileInstance;
}
private ProfileInstance UpdateProfileInstance(ProfileInstance pi)
{
pi.Name = "Another Name";
pi.Description = "Another Description";
return helper.ProfileInstances.Update(pi);
}
private ProfileInstance RetrieveProfileInstance(Guid iD)
{
var exposer = ProfileInstanceExposers.ID.Equal(iD);
var profileInstance = helper.ProfileInstances.Read(exposer);
return profileInstance.FirstOrDefault();
}
private ProfileInstance CreateProfileInstance()
{
ProfileInstance pi = new ProfileInstance();
pi.AppliesTo = new ProfileDefinition();
// pi.BasedOn.Add(...); ProfileInstance can be based upon another ProfileInstance (inheritance)
pi.Description = "A description";
pi.Name = "A Name";
pi.Values = new ProfileParameterEntry[]
{
new ProfileParameterEntry
{
Parameter = new Parameter(),
Remarks = "Example double parameter",
Value = new ParameterValue
{
DoubleValue = 12345,
Type = ParameterValue.ValueType.Double,
},
},
};
return helper.ProfileInstances.Create(pi);
}
}
Constructors
- ProfileInstance()
Initializes a new instance of the ProfileInstance class.
- ProfileInstance(ProfileInstance)
Initializes a new instance of the ProfileInstance class using the specified profile instance.
- ProfileInstance(Guid)
Initializes a new instance of the ProfileInstance class using the specified GUID.
Properties
- AppliesTo
Gets or sets the ProfileDefinition object to which this profile instance is linked.
- AppliesToID
Gets or sets the Guid of the profile definition to which this profile instance is linked.
- BasedOn
Gets the profile instances on which this profile instance is based.
- BasedOnIDs
Gets the GUIDs of the profile instances this profile instance is based on.
- ID
Gets or sets the ID of this profile instance.
- IsValueCopy
Gets or sets a value indicating whether this is a temporary profile instance copy or profile instance template.
- ProfileInstanceId
Gets or sets the profile instance ID.
- ServiceProfileInstanceID
Gets or sets the service profile instance ID.
- Values
Gets or sets the profile parameter entries of this profile instance.
Methods
- ApplyInstance(out string, params ElementInfoEventMessage[])
Applies this profile instance to the specified elements.
- Equals(ProfileInstance)
Indicates whether the current object is equal to another object of the same type.
- Equals(object)
Determines whether the specified object is equal to the current object.
- FiltersTo(ProfileInstance)
Determines whether this profile instance matches the specified filter.
- FindAllParameters()
Retrieves all profile instance parameter entries, including the profile parameter entries of the profile instances this profile instance is based on.
- FromXml(string)
Returns an instance of this class from the specified XML representation.
- GenerateDefaultParameterEntries(List<ProfileParameterEntry>)
Generates ProfileParameterEntry instances for all parameters that have default values defined and that are not present in the specified list.
- GenerateRequiredCapas(Func<ProfileParameterEntry, Parameter>)
This variant of the GenerateRequiredCapas method can be used to more efficiently calculate the required usages by providing funcs that should return the objects from an existing cache managed by the calling script.
- GenerateSets(out string, params ElementInfoEventMessage[])
Generates the SetParameterMessages required when trying to apply this ProfileInstance on one or more elements.
- GenerateSets(out string, params Tuple<ElementInfoEventMessage, GetProtocolInfoResponseMessage>[])
Generate the SetMessages required when trying to apply this ProfileInstance on one or more elements.
- GetHashCode()
Calculates the hash code for this object.
- GetInconsistentBasedOnIDs()
Retrieves the inconsistent basedOn IDs.
- GetInconsistentParameterValues()
Retrieves the inconsistent parameter values.
- HasCyclicDependency()
Returns a value indicating whether there is a cyclic dependency.
- HasRecursiveInheritance(ref HashSet<Guid>)
Returns a value indicating whether there is recursive inheritance.
- IsAppliesToConsistent()
Returns a value indicating whether appliesTo is consistent.
- IsConsistent()
Returns a value indicating whether it is consistent.
- ShouldSerializeAppliesToID()
Returns a value indicating whether the applies to ID should be serialized.
- ShouldSerializeBasedOn()
Returns a value indicating whether the basedOn IDs should be serialized.
- ToString()
Returns a string that represents the current object.
- ToXml()
Returns an XML representation of this object.
Events
- RequestResponseEvent
Event that is generated when this ProfileInstance wants to request data from SLNet itself (see: GenerateSets(out string, params ElementInfoEventMessage[]))