Imports

Discussion in 'ASP .Net' started by =?Utf-8?B?anNhbGU=?=, Dec 20, 2004.

  1. If I put
    imports xxx.ModuleName
    at the top of my asp.net page vb code, does this create an instance of the
    imported module that is unique to the page or does it just allow shared
    access to the module's functions?
    cheers,
    jsale
     
    =?Utf-8?B?anNhbGU=?=, Dec 20, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?anNhbGU=?=

    Patrice Guest

    Imports is just a notation that instructs the compiler to look into a
    particular namespace when a name is found that doesn't seem to belong to the
    "current" namespace.
    It doesn't do "things" like creating an instance of a module.

    It looks like what you are looking is that a module is actually a class with
    shared members (my personal preference would be to use this instead, you
    loose just the ability to call its members wihtout appending the class name
    before)...

    --

    "jsale" <> a écrit dans le message de
    news:...
    > If I put
    > imports xxx.ModuleName
    > at the top of my asp.net page vb code, does this create an instance of the
    > imported module that is unique to the page or does it just allow shared
    > access to the module's functions?
    > cheers,
    > jsale
     
    Patrice, Dec 20, 2004
    #2
    1. Advertising

  3. if i made the module into a class and instanced it on each page that uses the
    functions, would i be right in saying that there is no real way data could be
    'leaked' between users?
    you may remember me from some session questions last week - i'm still having
    problems with the information appearing on different users' screens and my
    main thought is that using the modules, they;re not instanced at any point,
    therefore if more than one user is using them at once, there could be leakage
    and errors. maybe... :)
    cheers for the information patrice :)

    "Patrice" wrote:

    > Imports is just a notation that instructs the compiler to look into a
    > particular namespace when a name is found that doesn't seem to belong to the
    > "current" namespace.
    > It doesn't do "things" like creating an instance of a module.
    >
    > It looks like what you are looking is that a module is actually a class with
    > shared members (my personal preference would be to use this instead, you
    > loose just the ability to call its members wihtout appending the class name
    > before)...
    >
    > --
    >
    > "jsale" <> a écrit dans le message de
    > news:...
    > > If I put
    > > imports xxx.ModuleName
    > > at the top of my asp.net page vb code, does this create an instance of the
    > > imported module that is unique to the page or does it just allow shared
    > > access to the module's functions?
    > > cheers,
    > > jsale

    >
    >
    >
     
    =?Utf-8?B?anNhbGU=?=, Dec 20, 2004
    #3
  4. =?Utf-8?B?anNhbGU=?=

    Shiva Guest

    Imports doesn't instantiate any modules/types. Its just for type name
    resolution only. It has effect only in the included page.

    "jsale" <> wrote in message
    news:...
    If I put
    imports xxx.ModuleName
    at the top of my asp.net page vb code, does this create an instance of the
    imported module that is unique to the page or does it just allow shared
    access to the module's functions?
    cheers,
    jsale
     
    Shiva, Dec 20, 2004
    #4
  5. =?Utf-8?B?anNhbGU=?=

    Patrice Guest

    Actually the problme is that shared members (either as members of a class or
    implicitely in a module are "shared" by the whole application and an ASP.NET
    site is a single application.
    As a result, users are sharing the same variables.

    You shouldn't use modules or a class with shared members. use a class and
    instantie this class for each user so that they have each their own copy...

    Patrice

    --

    "jsale" <> a écrit dans le message de
    news:D...
    > if i made the module into a class and instanced it on each page that uses

    the
    > functions, would i be right in saying that there is no real way data could

    be
    > 'leaked' between users?
    > you may remember me from some session questions last week - i'm still

    having
    > problems with the information appearing on different users' screens and my
    > main thought is that using the modules, they;re not instanced at any

    point,
    > therefore if more than one user is using them at once, there could be

    leakage
    > and errors. maybe... :)
    > cheers for the information patrice :)
    >
    > "Patrice" wrote:
    >
    > > Imports is just a notation that instructs the compiler to look into a
    > > particular namespace when a name is found that doesn't seem to belong to

    the
    > > "current" namespace.
    > > It doesn't do "things" like creating an instance of a module.
    > >
    > > It looks like what you are looking is that a module is actually a class

    with
    > > shared members (my personal preference would be to use this instead, you
    > > loose just the ability to call its members wihtout appending the class

    name
    > > before)...
    > >
    > > --
    > >
    > > "jsale" <> a écrit dans le message de
    > > news:...
    > > > If I put
    > > > imports xxx.ModuleName
    > > > at the top of my asp.net page vb code, does this create an instance of

    the
    > > > imported module that is unique to the page or does it just allow

    shared
    > > > access to the module's functions?
    > > > cheers,
    > > > jsale

    > >
    > >
    > >
     
    Patrice, Dec 20, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward
    Replies:
    1
    Views:
    2,423
    Edward
    Jul 8, 2003
  2. Bite My Bubbles

    REFERENCE VS IMPORTS

    Bite My Bubbles, Aug 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    355
    Bite My Bubbles
    Aug 25, 2003
  3. Albert
    Replies:
    4
    Views:
    10,890
    Albert
    Jul 10, 2008
  4. zildjohn01
    Replies:
    0
    Views:
    653
    zildjohn01
    Feb 22, 2011
  5. Victor Hooi
    Replies:
    1
    Views:
    108
    Devin Jeanpierre
    Nov 25, 2013
Loading...

Share This Page