Esempio n. 1
0
 /// <summary>
 /// Create api model from service model
 /// </summary>
 /// <param name="model"></param>
 public SimpleAttributeOperandApiModel(SimpleAttributeOperandModel model)
 {
     if (model == null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     NodeId      = model.NodeId;
     AttributeId = model.AttributeId;
     BrowsePath  = model.BrowsePath;
     IndexRange  = model.IndexRange;
 }
Esempio n. 2
0
 /// <summary>
 /// Create api model
 /// </summary>
 public static SimpleAttributeOperandApiModel ToApiModel(
     this SimpleAttributeOperandModel model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new SimpleAttributeOperandApiModel {
         NodeId = model.NodeId,
         AttributeId = (Core.Models.NodeAttribute?)model.AttributeId,
         BrowsePath = model.BrowsePath,
         IndexRange = model.IndexRange
     });
 }
 /// <summary>
 /// Convert to stack model
 /// </summary>
 /// <param name="model"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 public static SimpleAttributeOperand ToStackModel(this SimpleAttributeOperandModel model,
                                                   ServiceMessageContext context)
 {
     if (model == null)
     {
         return(null);
     }
     return(new SimpleAttributeOperand {
         TypeDefinitionId = model.NodeId.ToNodeId(context),
         AttributeId = (uint)(model.AttributeId ?? NodeAttribute.Value),
         BrowsePath = new QualifiedNameCollection(model.BrowsePath == null ?
                                                  Enumerable.Empty <QualifiedName>() :
                                                  model.BrowsePath?.Select(n => n.ToQualifiedName(context))),
         IndexRange = model.IndexRange
     });
 }