Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4610362
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:07:13+00:00 2026-05-22T01:07:13+00:00

Currently, my DomainService does perform an Initialization of a resource everytime a client is

  • 0

Currently, my DomainService does perform an Initialization of a resource everytime a client is connecting to him. Every client should access the same instance of this resource.
I would like to initialize this resource on the StartUp of the WebService. Is there any chance to do that with WCF Ria Services?

EDIT:
Okay, don’t mention it. I wanted to use this for an global DbContext object. This isn’t a good idea anyway, because there will be multiple threads managed by the HttpApplication which would access the DbContext simultaneously. I will change my implementation to an “per Thread”, respectively “per HttpContext”, approach. Thanks anyhow.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:07:14+00:00Added an answer on May 22, 2026 at 1:07 am

    You can define a class that contains a static property for that resource. In the DomainService you can then access that property. It would then be initialized only when it is accessed the first time.

    Example:

    public class ResManager {
        public static MyObject {...}
    }
    

    In the DomainService:

    public IQueryable<SomeClass> GetSomeObjects()
    {
        // you can access it here and it will not be initialized 
        // every time the DomainService is called
        MyObject obj = ResManager.MyObject;
        return new List<SomeClass>().AsQueryable();
    }
    

    If you want to initialize it when the Service is started, then you should be able to do that in the Global class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, Tapping on the same Tab (in which user is working), The App moves
The Scenario Currently I have a C# Silverlight Application That uses the domainservice class
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently we use jQuery to add RIA goodness to our apps, but recently we
Currently I have a class that looks like this: public class MyClass : IMyClass
Currently the HashSet<T> constructor that allows you to define your equality comparison yourself is
Currently developing an application using the newest version of symfony, obtained through PEAR. This
Currently I'm trying to write my first Python library and I've encountered the following
Currently we're parsing arp request output from the command line. string cmd = arp
Currently I have a DetailsView attached to a GridView. When you select an item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.