473,414 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Multithreading Confusion for C# DLL running in ASP.NET

Hello,
I am a little confused regarding the creation of a C# DLL that will be
called from ASP.NET. From what I have read ASP.NET is Multithreaded. My
undersatnding of this is that more than one thread can call into my object.
What coding considerations do I need to take for this?? Would the sample
class below need any changes to work under asp.net as to avoid any issues??

Thanks for any help!!
Ken

public class Test
{
//Module Variables.
private string privMyProperty = string.Empty;

public Test()
{
//Default Constructor Stuff.
}

//Property.
public string MyProperty
{
get
{
return privMyProperty;
}
set
{
privMyProperty = value;
}
}

public void Save()
{
//DO SOME WORK THAT USES PROPERTY.
}
}
Nov 15 '05 #1
3 1757
Hi Ken,

As long as your class is not shared among different sessions there is no
problem (static or stored in application cache or something like that)

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Ken Brannigan" <kb***@hotmail.com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
Hello,
I am a little confused regarding the creation of a C# DLL that will be
called from ASP.NET. From what I have read ASP.NET is Multithreaded. My
undersatnding of this is that more than one thread can call into my object. What coding considerations do I need to take for this?? Would the sample
class below need any changes to work under asp.net as to avoid any issues??
Thanks for any help!!
Ken

public class Test
{
//Module Variables.
private string privMyProperty = string.Empty;

public Test()
{
//Default Constructor Stuff.
}

//Property.
public string MyProperty
{
get
{
return privMyProperty;
}
set
{
privMyProperty = value;
}
}

public void Save()
{
//DO SOME WORK THAT USES PROPERTY.
}
}

Nov 15 '05 #2
Miha,
Thank you!! That makes sense.
Ken

"Miha Markic" <miha at rthand com> wrote in message
news:e%******************@TK2MSFTNGP10.phx.gbl...
Hi Ken,

As long as your class is not shared among different sessions there is no
problem (static or stored in application cache or something like that)

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Ken Brannigan" <kb***@hotmail.com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
Hello,
I am a little confused regarding the creation of a C# DLL that will be
called from ASP.NET. From what I have read ASP.NET is Multithreaded. My
undersatnding of this is that more than one thread can call into my

object.
What coding considerations do I need to take for this?? Would the sample
class below need any changes to work under asp.net as to avoid any

issues??

Thanks for any help!!
Ken

public class Test
{
//Module Variables.
private string privMyProperty = string.Empty;

public Test()
{
//Default Constructor Stuff.
}

//Property.
public string MyProperty
{
get
{
return privMyProperty;
}
set
{
privMyProperty = value;
}
}

public void Save()
{
//DO SOME WORK THAT USES PROPERTY.
}
}


Nov 15 '05 #3
u only need worry about concurrent access if the class makes use of static
variables and methods which are stateful - global data for example, or for
shared objects - as in the case where you pass an object around to different
threads.

in your example, if this private string privMyProperty was declared like
this private static string privMyProperty and this privMyProperty was
persisted somewhere, you would need to worry about concurrent access.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Ken Brannigan" <kb***@hotmail.com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
Hello,
I am a little confused regarding the creation of a C# DLL that will be
called from ASP.NET. From what I have read ASP.NET is Multithreaded. My
undersatnding of this is that more than one thread can call into my object. What coding considerations do I need to take for this?? Would the sample
class below need any changes to work under asp.net as to avoid any issues??
Thanks for any help!!
Ken

public class Test
{
//Module Variables.
private string privMyProperty = string.Empty;

public Test()
{
//Default Constructor Stuff.
}

//Property.
public string MyProperty
{
get
{
return privMyProperty;
}
set
{
privMyProperty = value;
}
}

public void Save()
{
//DO SOME WORK THAT USES PROPERTY.
}
}

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
5
by: sarge | last post by:
I would like to know how to perform simple multithreading. I had created a simple form to test out if I was multithreading properly, but got buggy results. Sometime the whole thig would lock up...
2
by: Rich | last post by:
Hello, I have set up a multithreading routine in a Test VB.net proj, and it appears to be working OK in debug mode and I am not using synchronization. Multithreading is a new thing for me, and...
55
by: Sam | last post by:
Hi, I have a serious issue using multithreading. A sample application showing my issue can be downloaded here: http://graphicsxp.free.fr/WindowsApplication11.zip The problem is that I need to...
0
luke14free
by: luke14free | last post by:
Hello, I was trying to run a multithreading example with python on my phone that lets me to record and play at the same time.I've found an example somewhere but, as expected it doesnt work,,,could...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.