How to use object shared on the Application level in the User Cont

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default How to use object shared on the Application level in the User Cont

    Hi,

    I am a newbie to ASP.NET and I would like to ask you to help me with the
    following problem.

    First, We have a class to represent a sql query repository, which would be
    shared between the session (the idea is to load the repository only once when
    the application is starting and then add the object inside the Application
    object collection). As a result, the Application['SqlRepository'] contains
    the instantiated object.

    Second, we have overloaded SqlDataSource object which gives the query name
    and the repository object and when the process of a query is requested, it
    loads the query command text from the repository.

    Finally, the problem is the following. How to get the repository object from
    the Application object automatically from the customized DataSource object.
    We just would like to prevent the situation that the programmer will have to
    set the repository property manually from the Application object in the code.
    This means we would like to automatically propagate the
    Application['SqlRepository'] value to all of the current/future instances of
    our customized DataSource in the runtime.

    Thank you for your hint,

    Martin
    Martin Guest

  2. Similar Questions and Discussions

    1. Shared user object array
      Maybe I am miss understanding this, but I have taken the sample_textchat application and have modified it slightly for my usage, I have got; ...
    2. HELP: ASP.NET Web Application, Impersonating User and Creating Threads via C++ COM Object
      Sorry for the long subject, but it summarizes my issue nicely. I have an ASP.NET application running ... it's a web app running under IIS. For...
    3. How to find which level of the object on?
      I do have my own constructor function for object. Say I have the constructor Ball(); I then: var Ball1 = new Ball(); Flash knows which level...
    4. Application level variables
      Christopher wrote: you need a permanent data store. usually available resources include text files, RDMS and code. global.asa is a good place...
    5. does an Sqlconnection object get shared at application level?
      thanks Paul, I did not think tht a variable would be shared application wide just because it was declared as static. I figured it would be session...
  3. #2

    Default RE: How to use object shared on the Application level in the User Cont

    Hi,

    I have finally found it. If I am not right, please correct me.

    protected SqlRepository SqlRepository
    {
    get
    {
    return (HttpContext.Current.Application["SqlRepository"] as
    SqlRepository);
    }
    }

    Martin

    "Martin" wrote:
    > Hi,
    >
    > I am a newbie to ASP.NET and I would like to ask you to help me with the
    > following problem.
    >
    > First, We have a class to represent a sql query repository, which would be
    > shared between the session (the idea is to load the repository only once when
    > the application is starting and then add the object inside the Application
    > object collection). As a result, the Application['SqlRepository'] contains
    > the instantiated object.
    >
    > Second, we have overloaded SqlDataSource object which gives the query name
    > and the repository object and when the process of a query is requested, it
    > loads the query command text from the repository.
    >
    > Finally, the problem is the following. How to get the repository object from
    > the Application object automatically from the customized DataSource object.
    > We just would like to prevent the situation that the programmer will have to
    > set the repository property manually from the Application object in the code.
    > This means we would like to automatically propagate the
    > Application['SqlRepository'] value to all of the current/future instances of
    > our customized DataSource in the runtime.
    >
    > Thank you for your hint,
    >
    > Martin
    Martin Guest

  4. #3

    Default Re: How to use object shared on the Application level in the User Cont


    "Martin" <Martin@discussions.microsoft.com> wrote in message
    news:1B38E626-E8CA-4417-BB6A-57887284F470@microsoft.com...
    > Hi,
    >
    > I have finally found it. If I am not right, please correct me.
    >
    > protected SqlRepository SqlRepository
    > {
    > get
    > {
    > return (HttpContext.Current.Application["SqlRepository"] as
    > SqlRepository);
    > }
    > }
    >
    > Martin
    This group is for Classic ASP.

    Try asking in the microsoft.public.dotnet.framework.aspnet group


    Anthony Jones Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139