C
Ciccio
Hi all,
I have a question about circular references and how to avoid it.
Please let me explain you quickly my problem with a short example.
I have two separate modules: payroll and timesheet. Each one of those
modules contains different classes. No to see through my problem i try to
simplify it
In the timesheet module:
Option Strict On
Imports PayrollModule
Public Class ReferenceTestClass
Private m_propwithin As String
Public Property PropWithin() As String
Get
Return m_propwithin
End Get
Set(ByVal value As String)
m_propwithin = value
End Set
End Property
Private m_collectionwithin As New
ReferenceTestClassCollection
Public Property CollectionWithin() As
ReferenceTestClassCollection
Get
Return m_collectionwithin
End Get
Set(ByVal value As ReferenceTestClassCollection)
m_collectionwithin = value
End Set
End Property
Private m_payrollObject As New WageType
Public Property PayrollObject() As WageType
Get
Return m_payrollObject
End Get
Set(ByVal value As WageType)
m_payrollObject = value
End Set
End Property
Private m_payrollCollection As New WageTypeCollection
Public Property PayrollCollection() As WageTypeCollection
Get
Return m_payrollCollection
End Get
Set(ByVal value As WageTypeCollection)
m_payrollCollection = value
End Set
End Property
Public Function localSub() As Boolean
Return True
End Function
Public Function externalSub() As WageType
Return New WageType
End Function
End Class
Public Class ReferenceTestClassCollection
Inherits ObjectModel.Collection(Of ReferenceTestClass)
End Class
In the Payroll module:
Public Class WageTypye
End Class
Public Class TestingClass
Public Sub main()
Dim myRefClass As New TimeSheetModule.ReferenceTestClass
myRefClass.propWithin = "Hello"
myRefClass.PayrollObject = New WageType /HERE THE
ERROR LINE
End Sub
End Class
following the error visual studio throws:
Error 1 Reference required to assembly 'Payroll, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' containing type
'PayrollModule.WageType', but a suitable reference could not be found due to
possible circular references:
Assembly 'TimeSheet.dll' references project 'PayrollModule'
Project 'PayrollModule' references assembly 'TimeSheet.dll'.
D:\Development\PersonalPro\Modules\Payroll\Payroll\Classes\TestingClass.vb 9
9 PayrollModule
Can anyone help me to solve this problem? Have i screwed it up completely?
Thanks a lot in advance
ciccio
I have a question about circular references and how to avoid it.
Please let me explain you quickly my problem with a short example.
I have two separate modules: payroll and timesheet. Each one of those
modules contains different classes. No to see through my problem i try to
simplify it
In the timesheet module:
Option Strict On
Imports PayrollModule
Public Class ReferenceTestClass
Private m_propwithin As String
Public Property PropWithin() As String
Get
Return m_propwithin
End Get
Set(ByVal value As String)
m_propwithin = value
End Set
End Property
Private m_collectionwithin As New
ReferenceTestClassCollection
Public Property CollectionWithin() As
ReferenceTestClassCollection
Get
Return m_collectionwithin
End Get
Set(ByVal value As ReferenceTestClassCollection)
m_collectionwithin = value
End Set
End Property
Private m_payrollObject As New WageType
Public Property PayrollObject() As WageType
Get
Return m_payrollObject
End Get
Set(ByVal value As WageType)
m_payrollObject = value
End Set
End Property
Private m_payrollCollection As New WageTypeCollection
Public Property PayrollCollection() As WageTypeCollection
Get
Return m_payrollCollection
End Get
Set(ByVal value As WageTypeCollection)
m_payrollCollection = value
End Set
End Property
Public Function localSub() As Boolean
Return True
End Function
Public Function externalSub() As WageType
Return New WageType
End Function
End Class
Public Class ReferenceTestClassCollection
Inherits ObjectModel.Collection(Of ReferenceTestClass)
End Class
In the Payroll module:
Public Class WageTypye
End Class
Public Class TestingClass
Public Sub main()
Dim myRefClass As New TimeSheetModule.ReferenceTestClass
myRefClass.propWithin = "Hello"
myRefClass.PayrollObject = New WageType /HERE THE
ERROR LINE
End Sub
End Class
following the error visual studio throws:
Error 1 Reference required to assembly 'Payroll, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' containing type
'PayrollModule.WageType', but a suitable reference could not be found due to
possible circular references:
Assembly 'TimeSheet.dll' references project 'PayrollModule'
Project 'PayrollModule' references assembly 'TimeSheet.dll'.
D:\Development\PersonalPro\Modules\Payroll\Payroll\Classes\TestingClass.vb 9
9 PayrollModule
Can anyone help me to solve this problem? Have i screwed it up completely?
Thanks a lot in advance
ciccio