Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inherited property does not set to itself
Message
De
22/01/2005 14:05:16
 
 
À
22/01/2005 10:01:49
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
00979501
Message ID:
00979645
Vues:
20
>I don't know much about "shadowing", as it seems to be a VB construct, but my guess is that you're not using it correctly. I've read about shadowing in the Help, so that's all I know about it. From your description of what's going on, I still can't quite figure out what you're trying to do that is not working. Could you explain it further by posting the relevant code?

My Web Service class starts like this:
Imports System.Web.Services

Public Class LXWebService
    Inherits System.Web.Services.WebService

    Public cSession As String = ""
    Public cStartupDirectory As String = Server.MapPath("")
    Public nNoMember As Integer = 0
    Public cIdentification As String = ""
    Public cData As String = ""
    Public cLogin As String = "Member"
    Public cUrl As String = ""
    Public cErrorDir As String = ""
    Public cTempDir As String = ""

    ' Check if the session is a valid one
    Public Function CheckLogin()
        Throw New System.Exception(cLogin)
        Dim llSuccess As Boolean
        llSuccess = Framework.Security.LoginSession(cLogin, cData)
        If llSuccess = False Then
            Throw New System.Exception(Framework.Security.cError)
        End If
        nNoMember = Framework.Security.nNoMember
        cIdentification = nNoMember.ToString + "," + System.Web.HttpContext.Current.Request.ServerVariables("REMOTE_ADDR") + ","
    End Function

End Class
I only put one method in it to show a workable class. You can see that the class as several field definitions at the top. The one I am trying to make it work is cLogin. cLogin is having a default value of Member. Member is a name of a table used for the authentication.

Then, my Web Service is defined like this:
Imports System.Web.Services
Imports System.IO
Imports System.XML
Imports Framework
Imports System.Data.OleDb

<System.Web.Services.WebService(Namespace:="http://tempuri.org/WebService/Service1")> _
Public Class DMIB
    Inherits LXWebService

    Shadows cUrl As String = Framework.FileFunction.GetIni(Me.cStartupDirectory + "\Main.ini", "System", "Server")
    Shadows cTempDir As String = Framework.FileFunction.GetIni(Me.cStartupDirectory + "\Main.ini", "System", "Temp")
    Shadows cData As String = Framework.FileFunction.GetIni(Me.cStartupDirectory + "\Main.ini", "System", "Data")
    Shadows cErrorDir As String = Framework.FileFunction.GetIni(Me.cStartupDirectory + "\Main.ini", "System", "ErrorDir")
    Shadows cLogin As String = "Login"

    <WebMethod()> _
    Public Function GetWebServiceVersion() As String
        CheckLogin()
        Dim loDirectory As New DirectoryInfo(Me.cStartupDirectory + "\Bin\")
        ...
    End Function
So, it is a derived class from the one defined at the top. In here, I have to overwrite the default value of cLogin. So, cLogin is using the Login.dbf table.

Inside this Web Service, when I access the cLogin field, it gives the proper value defined here. This is ok. So, for example, if before GetWebServiceVersion(), in the method I put in here, I would do:
        Throw New System.Exception(cLogin)
It would show "Login".

But, if I do such as I have right now, by calling CheckLogin(), which is defined in the class, as this method resides inside the class, the value of cLogin defined in the derived class is no longer available. Instead, the method of the class would return "Member". So, basically, the class seems protected for its value that we can only change from a derived class but the value changed in the derived class is not available from a method of the class.

As you can see, I have put:
        Throw New System.Exception(cLogin)
in CheckLogin() to see the value of the field which is frozen to the default value from that method.

This is what I am trying to resolve. Basically, if I change a value from the derived class, why isn't it available in the class itself?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform