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 7836439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:09:08+00:00 2026-06-02T14:09:08+00:00

I have a Windowsphone client who calls a business layer class(C# Class) through a

  • 0

I have a Windowsphone client who calls a business layer class(C# Class) through a webservice.

In my business layer class wich is a C# class, not silverlightclass i have List<int> numbers = new List<int>()
And from a method in the business layer class the list is filled with numbers. After this method have filled the list with numbers, the client layers is called again and a new method in my client is called and we are back in the business layer again. Here is the problem, i want to keep the List<int> numbers populated between calls from client layer to business layer. Now every time the businesslayer is called the List<int> numbers gets empty.

In a silverlight class I could use isolated storage to keep data alive on application level. In asp.net I could use application state, session or whatever.

How do I store this List in a C# class to save the data in the List between calls?

1st call
Client -> webservice -> businesslayer = List<int> numbers gets values
2nd call ( The problem)
Client -> webservice -> businesslayer = List<int> numbers I want the list to keep values from first call but instead it is empty because I can’t save the list to something like ApplicationState or Isolated Storage.

Here is my code regarding this problem

    public class TimereportDataAccess
    {
        TimereportDBEntities1 context = new TimereportDBEntities1();

        List<int> dayId = new List<int>(); // Used in sendDays() and sendWeeks()
        bool submitStatus = true; // Used in sendDays() and sendWeeks()

        public List<int> sendDays(List<Common.Day> days, bool status)
         {
            TimereportMappers mapper = new TimereportMappers();

             foreach(var item in mapper.dayMap(days))
             {
                context.Days.AddObject(item);
                context.SaveChanges();
                dayId.Add(item.Id);
             }

            if (status == true)
            {
                 submitStatus = true;
            }
            else
             {
                 submitStatus = false;
             }

              return dayId;
         }

         public void sendWeeks(List<Common.Week> weeks)
        {
            TimereportMappers mapper = new TimereportMappers();

             foreach (var item in mapper.weekMap(weeks))
             {              
                  context.Weeks.AddObject(item);
             }
             context.SaveChanges();


             int firstday;
             firstday = dayId.FirstOrDefault();
             if (submitStatus == true )
             {
                int reportId = (from u in context.Users
                                join r in context.Reports on u.Id equals r.UserId
                                join w in context.Weeks on r.Id equals w.ReportId
                                join d in context.Days on w.DayId equals d.Id
                                where d.Id.Equals(firstday)
                                select r.Id).SingleOrDefault();

                Reports report = context.Reports.SingleOrDefault(i => i.Id == reportId);
                report.Status = "submitted";
                context.SaveChanges();
             }

             dayId.Clear();            
         }
  • 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-06-02T14:09:11+00:00Added an answer on June 2, 2026 at 2:09 pm

    In order to keep your objects persisted in the memory, first you need to ensure that your wcf service is not working in per call mode. If this is the case, each time you make a call to the service, a new thread will be generated with new objects. I assume you have marked your service as per session.

    Then you can mark the object as static and at the first call, you can fetch the data from the database; and when service receives another call, you can just check whether your list has been populated and send back the memory list.

    On the otherhand, there is a problem with this approach; what if the database changes? the list remains the same even if the database changes. So you need to employ some kind of dirty mechanism and mark your list as dirty. And whenever it is dirty you need to fetch it again from the database.

    If you think your list does not change, then you do not need to store it in the database, you can just use an XML file.

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

Sidebar

Related Questions

I have client-server application, where server side is Azure WCF service with data in
I have a user control that displays objects of a client-declared type with some
Simply put, I have my RSSItem Class and my RSSService class, and a button
I have a Windows Phone 7 app that (currently) calls an OData service to
I would like to make my application on windowsphone remember that I have checked
I have published an Windows phone 7 application to marketplace through Private Beta Test
In my WindowsPhone application I have a Text Box that needs to receive focus
I'm working on the new WindowsPhone platform. I have a few intances of a
I have a webservice method which described as follow: POST /servis.asmx HTTP/1.1 Host: webservice.myproject.com
I have a WCF Service deployed in azure. I have a client consuming this

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.