Exemplo n.º 1
0
 /// <summary>
 /// Gets the instance configuration - collection of data sets represented as the <see cref="IInstanceConfiguration"/>.
 /// </summary>
 /// <param name="descriptor">The descriptor.</param>
 /// <returns>IEnumerable&lt;IInstanceConfiguration&gt;.</returns>
 public DataSetConfiguration GetInstanceConfiguration(NodeDescriptor descriptor)
 {
     DataSetConfiguration _node = DataSetsList.Where<DataSetConfiguration>(x => x.Root.CreateWrapper().CompareTo(descriptor) == 0).FirstOrDefault<DataSetConfiguration>();
       if (_node == null)
     _node = DataSetConfiguration.Create(descriptor);
       return _node;
 }
Exemplo n.º 2
0
 internal static DataSetConfiguration Create(NodeDescriptor descriptor)
 {
     if (descriptor == null)
     throw new ArgumentNullException(nameof(descriptor));
       if (descriptor.NodeIdentifier == null || descriptor.NodeIdentifier.IsEmpty)
     throw new ArgumentNullException(nameof(descriptor.NodeIdentifier));
       NodeDescriptor _newRoot = new NodeDescriptor()
       {
     BindingDescription = descriptor.BindingDescription,
     DataType = descriptor.DataType,
     InstanceDeclaration = descriptor.InstanceDeclaration,
     NodeClass = descriptor.NodeClass,
     NodeIdentifier = descriptor.NodeIdentifier
       };
       DataSetConfiguration _new = new DataSetConfiguration()
       {
     AssociationName = descriptor.NodeIdentifier.ToString(),
     AssociationRole = AssociationRole.Producer,
     DataSet = new FieldMetaData[0],
     DataSymbolicName = descriptor.NodeIdentifier.ToString(),
     ExtensionData = null,
     Id = System.Guid.NewGuid(),
     RepositoryGroup = "[RepositoryGroup]",
     Root = _newRoot,
       };
       return _new;
 }
Exemplo n.º 3
0
        internal static DataSetConfiguration Create(NodeDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }
            if (descriptor.NodeIdentifier == null || descriptor.NodeIdentifier.IsEmpty)
            {
                throw new ArgumentNullException(nameof(descriptor.NodeIdentifier));
            }
            NodeDescriptor _newRoot = new NodeDescriptor()
            {
                BindingDescription  = descriptor.BindingDescription,
                DataType            = descriptor.DataType,
                InstanceDeclaration = descriptor.InstanceDeclaration,
                NodeClass           = descriptor.NodeClass,
                NodeIdentifier      = descriptor.NodeIdentifier
            };
            DataSetConfiguration _new = new DataSetConfiguration()
            {
                AssociationName  = descriptor.NodeIdentifier.ToString(),
                AssociationRole  = AssociationRole.Producer,
                DataSet          = new FieldMetaData[0],
                DataSymbolicName = descriptor.NodeIdentifier.ToString(),
                ExtensionData    = null,
                Id = System.Guid.NewGuid(),
                RepositoryGroup = "[RepositoryGroup]",
                Root            = _newRoot,
            };

            return(_new);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the instance configuration - collection of data sets represented as the <see cref="DataSetConfiguration"/>.
        /// </summary>
        /// <param name="descriptor">The descriptor.</param>
        /// <returns>IEnumerable&lt;IInstanceConfiguration&gt;.</returns>
        public DataSetConfiguration GetInstanceConfiguration(NodeDescriptor descriptor)
        {
            DataSetConfiguration _node = DataSetsList.Where <DataSetConfiguration>(x => x.Root.CreateWrapper().CompareTo(descriptor) == 0).FirstOrDefault <DataSetConfiguration>();

            if (_node == null)
            {
                _node = DataSetConfiguration.Create(descriptor);
            }
            return(_node);
        }
Exemplo n.º 5
0
 public void CreatorTest()
 {
     NodeDescriptor _newDescriptor = new NodeDescriptor()
       {
     BindingDescription = "BindingDescription",
     DataType = new System.Xml.XmlQualifiedName("DataType", m_Namespace),
     InstanceDeclaration = false,
     NodeClass = InstanceNodeClassesEnum.Object,
     NodeIdentifier = new System.Xml.XmlQualifiedName("Name1", m_Namespace)
       };
       IComparable _comparer = _newDescriptor.CreateWrapper();
       Assert.AreEqual<int>(0, _comparer.CompareTo(_comparer));
 }
Exemplo n.º 6
0
 public void PrecedenceTestMethod()
 {
     NodeDescriptor _FirstNewDescriptor = new NodeDescriptor()
       {
     BindingDescription = "BindingDescription",
     DataType = new System.Xml.XmlQualifiedName("DataType", m_Namespace),
     InstanceDeclaration = false,
     NodeClass = InstanceNodeClassesEnum.Object,
     NodeIdentifier = new System.Xml.XmlQualifiedName("Name1", m_Namespace)
       };
       NodeDescriptor _SecondNewDescriptor = new NodeDescriptor()
       {
     BindingDescription = "BindingDescription",
     DataType = new System.Xml.XmlQualifiedName("DataType", m_Namespace),
     InstanceDeclaration = false,
     NodeClass = InstanceNodeClassesEnum.Object,
     NodeIdentifier = new System.Xml.XmlQualifiedName("Name2", m_Namespace)
       };
       IComparable _FirstComparer = _FirstNewDescriptor.CreateWrapper();
       IComparable _SecondComparer = _SecondNewDescriptor.CreateWrapper();
       Assert.IsTrue(_FirstComparer.CompareTo(_SecondComparer ) <0);
       Assert.IsTrue(_SecondComparer.CompareTo(_FirstComparer) > 0 );
 }
Exemplo n.º 7
0
 public NodeDescriptorWrapper(NodeDescriptor repository)
 {
     m_repository = repository;
 }
Exemplo n.º 8
0
 public NodeDescriptorWrapper(NodeDescriptor repository)
 {
     m_repository = repository;
 }