0

私は2つのクラスCustomerService classCellphoneCustomerServiceクラスを持っています。CellphoneCustomerServicクラスから派生したCustomerServiceクラス。クラスは、クラスのプロパティをCellphoneCustomerServiceシャドウします。CustomerRepositoryCustomerService

Public Class CustomerService
        <Microsoft.Practices.Unity.Dependency()> _
        Public Property CustomerRepository as ISQLRepository
            Set (Byval value As SQLRepository)
                _customerRepository = value
            End Set         
            Get 
                Return _customerRepository
            End Get
        End Property


        Public Sub Save(Byval Cust As Customer)
            Me.CustomerRepository.Save(object)
        End Sub

        Public Function GetAllCustomers(Byval Query As String) As Customer
            Me.CustomerRepository.GetAllCustomer(Byval Query As String)
        End Sub

        Public Function GetCustomer(Byval ID As Integer)
            Me.CustomerRepository.GetCustomer(object)
        End Sub             
End Class


Public Class CellphoneCustomerService
    Inherits CustomerService
        <Microsoft.Practices.Unity.Dependency()> _
        Public Shadow Property CustomerRepository As IOracleRepository
            Set (Byval value As OracleRepository)
                _customerRepository = value
            End Set         
            Get 
                Return _customerRepository
            End Get
        End Property            
End Class

このコードに関する私の問題は、CellphoneCustomerServiceクラスのインスタンスを作成し、Save メソッド、GetAllCustomersおよびGetCustomer関数を使用するときに、派生クラスCustomerRepositoryのシャドウ プロパティではなく、基本クラスのプロパティを引き続き使用することです。CustomerRepository

私がする必要があるのは、オブジェクトが のCellphoneCustomerService場合、基本クラスはクラスのシャドウCustomerRepositoryプロパティを使用する必要CellphoneCustomerServiceがありますが、オブジェクトがCustomerServiceクラスの場合は独自のCustomerRepositoryプロパティを使用します。

4

0 に答える 0