´╗┐Option Explicit On
Option Strict On

Imports System
Imports System.Xml

'**********************************************************************************************
'* Copyright (c) 2001-2017 Liquid Technologies Limited. All rights reserved.
'* See www.liquid-technologies.com for product details.
'*
'* Please see products End User License Agreement for distribution permissions.
'*
'* WARNING: THIS FILE IS GENERATED
'* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
'*
'* Generation  :  by Liquid XML Data Binder 15.0.1.7161
'* Using Schema: D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\Cardinality\Schema\Cardinality.xsd
'**********************************************************************************************

Namespace CardinalityLib

    ''' <summary>
    ''' This class represents the Element MyRootObject
    ''' </summary>
    <LiquidTechnologies.Runtime.Net45.XmlObjectInfo(LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementGroupType.Sequence, _
                                                    LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, _
                                                    "MyRootObject", "", true, false, _
                                                    LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_none, Nothing, false)> _
    Public Partial Class MyRootObject
        Inherits CardinalityLib.XmlCommonBase

        #Region "Constructors"
        ''' <summary>
        '''    Constructor for MyRootObject
        ''' </summary>
        ''' <remarks>
        '''    The class is created with all the mandatory fields populated with the
        '''    default data. 
        '''    All Collection object are created.
        '''    However any 1-n relationships (these are represented as collections) are
        '''    empty. To comply with the schema these must be populated before the xml
        '''    obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\Cardinality\Schema\Cardinality.xsd
        ''' </remarks>
        Public Sub New()
            _elementName = "MyRootObject"
            Init()
        End Sub
        
        Public Sub New(ByVal elementName as String)
            _elementName = elementName
            Init()
        End Sub
        #End Region

        #Region "Initialization methods for the class"
        ''' <summary>
        '''    Initializes the class
        ''' </summary>
        ''' <remarks>
        '''    The Creates all the mandatory fields (populated with the default data) 
        '''    All Collection object are created.
        '''    However any 1-n relationships (these are represented as collections) are
        '''    empty. To comply with the schema these must be populated before the xml
        '''    obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\Cardinality\Schema\Cardinality.xsd.
        ''' </remarks>
        Protected Overrides Sub Init()
            CardinalityLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place
            _ASimpleStringMandatoryElement = ""
            _ASimpleDateMandatoryElement = new LiquidTechnologies.Runtime.Net45.XmlDateTime(LiquidTechnologies.Runtime.Net45.XmlDateTime.DateType.date)
            _AComplexMandatoryElement = new CardinalityLib.AComplexMandatoryElement("AComplexMandatoryElement")
            _ASimpleStringOptionalElement = ""
            _IsValidASimpleStringOptionalElement = false 
            _ASimpleDateOptionalElement = new LiquidTechnologies.Runtime.Net45.XmlDateTime(LiquidTechnologies.Runtime.Net45.XmlDateTime.DateType.date)
            _IsValidASimpleDateOptionalElement = false 
            _AComplexOptionalElement = Nothing
            _ASimpleStringCollectionElement = new CardinalityLib.XmlSimpleTypeCollection(Of String)("ASimpleStringCollectionElement", "", LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_string, 0, -1, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Preserve, new LiquidTechnologies.Runtime.Net45.PrimitiveRestrictions("", "-1", "-1", "", "", "", "", "-1", "-1", "-1"))
            _ASimpleDateCollectionElement = new CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.Net45.XmlDateTime)("ASimpleDateCollectionElement", "", LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_date, 0, -1, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Collapse, new LiquidTechnologies.Runtime.Net45.PrimitiveRestrictions("", "-1", "-1", "", "", "", "", "-1", "-1", "-1"))
            _AComplexCollectionElement = new CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement)("AComplexCollectionElement", "", 0, -1, false)



' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional initialization code here...

' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
        End Sub

        #End Region

        #Region "ICloneable Interface"
        ''' <summary>
        '''    Allows the class to be copied
        ''' </summary>
        ''' <remarks>
        '''    Performs a 'deep copy' of all the data in the class (and its children)
        ''' </remarks>
        Public Overrides Function Clone() As Object
            Dim newObject As New CardinalityLib.MyRootObject(_elementName)
            Dim o As Object
            newObject._ASimpleStringMandatoryElement = _ASimpleStringMandatoryElement
            newObject._ASimpleDateMandatoryElement = CType(_ASimpleDateMandatoryElement.Clone(), LiquidTechnologies.Runtime.Net45.XmlDateTime)
            newObject._AComplexMandatoryElement = Nothing
            if (Not _AComplexMandatoryElement Is Nothing) Then
                newObject._AComplexMandatoryElement = CType(_AComplexMandatoryElement.Clone(), CardinalityLib.AComplexMandatoryElement)
            End If
            newObject._ASimpleStringOptionalElement = _ASimpleStringOptionalElement
            newObject._IsValidASimpleStringOptionalElement = _IsValidASimpleStringOptionalElement
            newObject._ASimpleDateOptionalElement = CType(_ASimpleDateOptionalElement.Clone(), LiquidTechnologies.Runtime.Net45.XmlDateTime)
            newObject._IsValidASimpleDateOptionalElement = _IsValidASimpleDateOptionalElement
            newObject._AComplexOptionalElement = Nothing
            if (Not _AComplexOptionalElement Is Nothing) then
                newObject._AComplexOptionalElement = CType(_AComplexOptionalElement.Clone(), CardinalityLib.AComplexOptionalElement)
            End If
            For Each o in _ASimpleStringCollectionElement
                newObject._ASimpleStringCollectionElement.Add(CType(o, String))
            Next o
            For Each o in _ASimpleDateCollectionElement
                newObject._ASimpleDateCollectionElement.Add(CType(CType(o, LiquidTechnologies.Runtime.Net45.XmlDateTime).Clone(), LiquidTechnologies.Runtime.Net45.XmlDateTime))
            Next o
            For Each o in _AComplexCollectionElement
                newObject._AComplexCollectionElement.Add(CType(CType(o, CardinalityLib.AComplexCollectionElement).Clone(), CardinalityLib.AComplexCollectionElement))
            Next o

            o = Nothing


' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional clone code here...

' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

            Return newObject
        End Function
        #End Region

        #Region "Member variables"

        Protected Overrides Readonly Property TargetNamespace() as String
            Get 
                Return ""
            End Get
        End Property

        #Region "Attribute - ASimpleStringMandatoryElement"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' It is defaulted to "".
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimMnd("ASimpleStringMandatoryElement", "", Nothing, LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Preserve, "", "-1", "-1", "", "", "", "", "-1", "-1", "-1")> _
        Public Property ASimpleStringMandatoryElement() as String
            Get 
                Return _ASimpleStringMandatoryElement  
            End Get
            Set(ByVal value As String) 
                ' Apply whitespace rules appropriately
                value = LiquidTechnologies.Runtime.Net45.WhitespaceUtils.Preserve(value) 
                CheckElementRestriction(0, value)
                _ASimpleStringMandatoryElement = value 
            End Set
        End Property
        Protected _ASimpleStringMandatoryElement As String

        #End Region
    
        #Region "Attribute - ASimpleDateMandatoryElement"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' It is defaulted to new LiquidTechnologies.Runtime.Net45.XmlDateTime(LiquidTechnologies.Runtime.Net45.XmlDateTime.DateType.date).
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimMnd("ASimpleDateMandatoryElement", "", Nothing, LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_date, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Collapse, "", "-1", "-1", "", "", "", "", "-1", "-1", "-1")> _
        Public Property ASimpleDateMandatoryElement() as LiquidTechnologies.Runtime.Net45.XmlDateTime
            Get 
                Return _ASimpleDateMandatoryElement  
            End Get
            Set(ByVal value As LiquidTechnologies.Runtime.Net45.XmlDateTime) 
                CheckElementRestriction(1, value)
                _ASimpleDateMandatoryElement.SetDateTime(value, _ASimpleDateMandatoryElement.Type) 
            End Set
        End Property
        Protected _ASimpleDateMandatoryElement As LiquidTechnologies.Runtime.Net45.XmlDateTime

        #End Region
    
        #Region "Attribute - AComplexMandatoryElement"
        ''' <summary>
        ''' Represents a mandatory Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is mandatory and therefore must be populated within the XML.
        ''' If this property is set, then the object will be COPIED. If the property is set to null an exception is raised.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsMnd("AComplexMandatoryElement", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, GetType(CardinalityLib.AComplexMandatoryElement), true)> _
        Public Property AComplexMandatoryElement() As CardinalityLib.AComplexMandatoryElement
            Get 
                Return _AComplexMandatoryElement  
            End Get
            Set(ByVal value As CardinalityLib.AComplexMandatoryElement)  
                Throw_IfPropertyIsNull(value, "AComplexMandatoryElement")
                if (Not value Is Nothing) Then
                    SetElementName(value, "AComplexMandatoryElement")
                End If
                _AComplexMandatoryElement = value 
            End Set
        End Property
        Protected _AComplexMandatoryElement As CardinalityLib.AComplexMandatoryElement
        
        #End Region
    
        #Region "Attribute - ASimpleStringOptionalElement"
        ''' <summary>
        ''' Represents an optional Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is optional, initially it is not valid.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimOpt("ASimpleStringOptionalElement", "", "IsValidASimpleStringOptionalElement", Nothing, LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Preserve, "", "-1", "-1", "", "", "", "", "-1", "-1", "-1")> _
        Public Property ASimpleStringOptionalElement() As String
            Get 
                if (_IsValidASimpleStringOptionalElement = false) Then
                    throw new LiquidTechnologies.Runtime.Net45.LtInvalidStateException("The Property ASimpleStringOptionalElement is not valid. Set ASimpleStringOptionalElementValid = true")
                End If
                Return _ASimpleStringOptionalElement  
            End Get
            Set(ByVal value As String) 
                CheckElementRestriction(3, value)
                ' Apply whitespace rules appropriately
                value = LiquidTechnologies.Runtime.Net45.WhitespaceUtils.Preserve(value) 
                _IsValidASimpleStringOptionalElement = true
                _ASimpleStringOptionalElement = value 
            End Set
        End Property
        ''' <summary>
        ''' Indicates if ASimpleStringOptionalElement contains a valid value.
        ''' </summary>
        ''' <remarks>
        ''' true if the value for ASimpleStringOptionalElement is valid, false if not.
        '''    If this is set to true then the property is considered valid, and assigned its
        '''    default value ("").
        '''    If its set to false then its made invalid, and subsequent calls to get ASimpleStringOptionalElement
        '''    will raise an exception.
        ''' </remarks>
        Public Property IsValidASimpleStringOptionalElement() As Boolean 
            Get
                Return _IsValidASimpleStringOptionalElement
            End Get
            Set(ByVal value As Boolean) 
                If (value <> _IsValidASimpleStringOptionalElement) Then
                    ASimpleStringOptionalElement = ""
                    _IsValidASimpleStringOptionalElement = value
                End If
            End Set
        End Property
        Protected _IsValidASimpleStringOptionalElement as Boolean
        Protected _ASimpleStringOptionalElement as String
        #End Region
    
        #Region "Attribute - ASimpleDateOptionalElement"
        ''' <summary>
        ''' Represents an optional Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is optional, initially it is not valid.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimOpt("ASimpleDateOptionalElement", "", "IsValidASimpleDateOptionalElement", Nothing, LiquidTechnologies.Runtime.Net45.Conversions.ConversionType.type_date, Nothing, LiquidTechnologies.Runtime.Net45.WhitespaceUtils.WhitespaceRule.Collapse, "", "-1", "-1", "", "", "", "", "-1", "-1", "-1")> _
        Public Property ASimpleDateOptionalElement() As LiquidTechnologies.Runtime.Net45.XmlDateTime
            Get 
                if (_IsValidASimpleDateOptionalElement = false) Then
                    throw new LiquidTechnologies.Runtime.Net45.LtInvalidStateException("The Property ASimpleDateOptionalElement is not valid. Set ASimpleDateOptionalElementValid = true")
                End If
                Return _ASimpleDateOptionalElement  
            End Get
            Set(ByVal value As LiquidTechnologies.Runtime.Net45.XmlDateTime) 
                CheckElementRestriction(4, value)
                _IsValidASimpleDateOptionalElement = true
                _ASimpleDateOptionalElement.SetDateTime(value, _ASimpleDateOptionalElement.Type) 
            End Set
        End Property
        ''' <summary>
        ''' Indicates if ASimpleDateOptionalElement contains a valid value.
        ''' </summary>
        ''' <remarks>
        ''' true if the value for ASimpleDateOptionalElement is valid, false if not.
        '''    If this is set to true then the property is considered valid, and assigned its
        '''    default value (new LiquidTechnologies.Runtime.Net45.XmlDateTime(LiquidTechnologies.Runtime.Net45.XmlDateTime.DateType.date)).
        '''    If its set to false then its made invalid, and subsequent calls to get ASimpleDateOptionalElement
        '''    will raise an exception.
        ''' </remarks>
        Public Property IsValidASimpleDateOptionalElement() As Boolean 
            Get
                Return _IsValidASimpleDateOptionalElement
            End Get
            Set(ByVal value As Boolean) 
                If (value <> _IsValidASimpleDateOptionalElement) Then
                    ASimpleDateOptionalElement = new LiquidTechnologies.Runtime.Net45.XmlDateTime(LiquidTechnologies.Runtime.Net45.XmlDateTime.DateType.date)
                    _IsValidASimpleDateOptionalElement = value
                End If
            End Set
        End Property
        Protected _IsValidASimpleDateOptionalElement as Boolean
        Protected _ASimpleDateOptionalElement as LiquidTechnologies.Runtime.Net45.XmlDateTime
        #End Region
    
        #Region "Attribute - AComplexOptionalElement"
        ''' <summary>
        ''' Represents an optional Element in the XML document
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' It is optional, initially it is null.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsOpt("AComplexOptionalElement", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element, GetType(CardinalityLib.AComplexOptionalElement))> _
        Public Property AComplexOptionalElement() As CardinalityLib.AComplexOptionalElement
            Get 
                Return _AComplexOptionalElement  
            End Get
            Set(ByVal value As CardinalityLib.AComplexOptionalElement) 
                if (value Is Nothing) Then
                    _AComplexOptionalElement = Nothing
                else
                    SetElementName(value, "AComplexOptionalElement")
                    _AComplexOptionalElement = value 
                End If
            End Set
        End Property
        Protected _AComplexOptionalElement As CardinalityLib.AComplexOptionalElement
        
        #End Region
    
        #Region "Attribute - ASimpleStringCollectionElement"
        ''' <summary>
        ''' A collection of Strings
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' This collection may contain 0 to Many Strings.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimCol("ASimpleStringCollectionElement", "")> _
        Public Readonly Property ASimpleStringCollectionElement() as CardinalityLib.XmlSimpleTypeCollection(Of String)
            Get 
                Return _ASimpleStringCollectionElement
            End Get
        End Property

        Protected _ASimpleStringCollectionElement As CardinalityLib.XmlSimpleTypeCollection(Of String)

        #End Region
    
        #Region "Attribute - ASimpleDateCollectionElement"
        ''' <summary>
        ''' A collection of LiquidTechnologies.Runtime.Net45.XmlDateTimes
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' This collection may contain 0 to Many LiquidTechnologies.Runtime.Net45.XmlDateTimes.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqPrimCol("ASimpleDateCollectionElement", "")> _
        Public Readonly Property ASimpleDateCollectionElement() as CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.Net45.XmlDateTime)
            Get 
                Return _ASimpleDateCollectionElement
            End Get
        End Property

        Protected _ASimpleDateCollectionElement As CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.Net45.XmlDateTime)

        #End Region
    
        #Region "Attribute - AComplexCollectionElement"
        ''' <summary>
        ''' A collection of AComplexCollectionElements
        ''' </summary>
        ''' <remarks>
        ''' This property is represented as an Element in the XML.
        ''' This collection may contain 0 to Many objects.
        ''' </remarks>
        <LiquidTechnologies.Runtime.Net45.ElementInfoSeqClsCol("AComplexCollectionElement", "", LiquidTechnologies.Runtime.Net45.XmlObjectBase.XmlElementType.Element)> _
        Public Readonly Property AComplexCollectionElement() As CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement)
            Get 
                Return _AComplexCollectionElement 
            End Get
        End Property
        Protected _AComplexCollectionElement As CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement)
        
        #End Region
    
        #Region "Attribute - Namespace"
        Public Overrides Readonly Property [Namespace]() As String
            Get 
                Return ""  
            End Get
        End Property
        #End Region

        #Region "Attribute - GetBase"
        Public Overrides Function GetBase() As LiquidTechnologies.Runtime.Net45.XmlObjectBase
            Return Me
        End Function
        #End Region
        #End Region


' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional Methods and members here...

' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    End Class
End Namespace