473,410 Members | 1,930 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,410 software developers and data experts.

ApplicationManager.cs - has anyone used this location for their datamappers?

Hi ALL,
Our consultant added the datamapper definitions to our ApplicationManager.cs
file. Has anyone else used this technique, and how has it benefited you?
Here is what a sample of it looks like:

public static LaborRateDataMapper LaborRateDM;

static ApplicationManager()
{
LaborRateDM = new LaborRateDataMapper();
}

I've added 3 rows to my LaborRateTable, which appears via the
ApplicationManager datamapper. BUT, if I try to access these same rows
directly via LaborRateTable, the system is telling me that there are no
records.

Any ideas?

TIA, Randy Smith
Jan 11 '07 #1
1 1452
That's the only true way to achieve a lazy-loaded singleton in .NET. All
other methods will generally result in a [very very] slim possibility for
threading issues (As a matter of fact, the most used approach, double-locks
doesn't even work in Java, even though it's very widely used).

Given that it IS the correct implementation of a common design pattern, the
best we can do given the information provided is tell you that everything
looks ok. The question is whether you want LaborRateDataMapper instance
within your ApplicationManager to be a singleton -which is something no one
will be able to answer.

A couple notes though, there's a growing movement which feels that the
singleton is actually an anti-pattern. Also, static constructors introduce
a performance [very slight] performance penalty since any access to _any_
class members requires the CLR to check if the static constructor has
already been executed. FxCop will report this issue.

As for your problem, I can only guess that you have another instance of
LaborRateDataMapper somewhere. It would seem (although it's very hard to
tell), that the LaborRateDataMapper singleton should be implemented inside
the LaborRateDataMapper class, and not the ApplicationManager class -
although that's just a guess.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Randy Smith" <rs****@cta.orgwrote in message
news:OB**************@TK2MSFTNGP04.phx.gbl...
Hi ALL,
Our consultant added the datamapper definitions to our
ApplicationManager.cs file. Has anyone else used this technique, and how
has it benefited you? Here is what a sample of it looks like:

public static LaborRateDataMapper LaborRateDM;

static ApplicationManager()
{
LaborRateDM = new LaborRateDataMapper();
}

I've added 3 rows to my LaborRateTable, which appears via the
ApplicationManager datamapper. BUT, if I try to access these same rows
directly via LaborRateTable, the system is telling me that there are no
records.

Any ideas?

TIA, Randy Smith
Jan 11 '07 #2

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

Similar topics

4
by: Iver Erling Årva | last post by:
I have an application that uses a window.open() to open it's own main window where all my programs takes place. I use a timeout so if nothing goes on for 15 minutes the document below is called. To...
11
by: Robert Schuldenfrei | last post by:
I am an older person trying to learn C# just for the fun of it. I am a veteran of older style languages (COBOL, FORTRAN, etc.) and I want to learn an Object Orientated language. Currently working...
8
by: Jim Hubbard | last post by:
I am looking for patterns for a distributed .Net application for a small retail chain. The owner wants the stores to have access to all data (no matter which store it comes from) in real time. ...
14
by: salad | last post by:
XML seems to be a hot technology buzzword. And it appears XML is supported in A2003. I am wondering if it could be used in the following scenario. I create an order record for the customer. ...
169
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
4
by: Polaris431 | last post by:
I have a web application in ASP.NET that will be used globally. Data is collected on mobile devices running Windows Mobile and sent to the web server where it is stored and can be viewed. Data is...
0
by: mmueller | last post by:
I am new to reporting services 2005 (reporting in Access for years and older versions of Reporting Services from time to time) and this is probably a dumb question... but I have no internal resources...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I placed a button on a form menustrip for the purpose of causing the horizontal scrollbar of my form to appear so that I can access controls outside of the form's current view (the controls are...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.