473,756 Members | 5,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi ALL,
Our consultant added the datamapper definitions to our ApplicationMana ger.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 LaborRateDataMa pper LaborRateDM;

static ApplicationMana ger()
{
LaborRateDM = new LaborRateDataMa pper();
}

I've added 3 rows to my LaborRateTable, which appears via the
ApplicationMana ger 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 1470
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 LaborRateDataMa pper instance
within your ApplicationMana ger 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
LaborRateDataMa pper somewhere. It would seem (although it's very hard to
tell), that the LaborRateDataMa pper singleton should be implemented inside
the LaborRateDataMa pper class, and not the ApplicationMana ger class -
although that's just a guess.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Randy Smith" <rs****@cta.org wrote in message
news:OB******** ******@TK2MSFTN GP04.phx.gbl...
Hi ALL,
Our consultant added the datamapper definitions to our
ApplicationMana ger.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 LaborRateDataMa pper LaborRateDM;

static ApplicationMana ger()
{
LaborRateDM = new LaborRateDataMa pper();
}

I've added 3 rows to my LaborRateTable, which appears via the
ApplicationMana ger 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
9514
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 log in again all the users have to do is to click the link in the lower part of the window. This causes the login window to show up again. The problem arise if the window that opened this window has been closed in the meantime. To deal with this...
11
3278
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 my way through Murach's C# by Joel Murach and Doug Lowe. Since I am not taking a course, I have no one to whom I can address questions. That is why I am turning to this newsgroup. Is this the best NG for a newbie like me? Are there people out...
8
1257
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. In the case of an internet outage, the store owner would like for the individual stores to still have access to (at least) all data from all stores as of the previous day. This looks like a possible pain in the *........real-time data in N...
14
3741
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. This customer is one I do a lot of business with. I could create an email to send him a copy of the order. A more preferable approach would be to transfer to the customer the order and order items parts which could then be imported/used to update...
169
9166
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 untaking to create a toolchain for it. Way back when, there used to be something called "Small C". I wonder if the creator(s) of that would want to embark on creating a nice little Small C++ compiler devoid of C++ language features that make...
94
30343
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 Statement (C# Reference) statement to serialize access. " But when is it better to use "volatile" instead of "lock" ?
4
4404
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 timestamped when it is sent from a PDA device to the server. I am writing software for both the web app and the PDA. The web server is located at one location while the PDA devices are located around the world. The question is, how do I handle...
0
1401
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 since I am the first to use it so... here you go: I have a report I am trying to recreate, the old one is in a PowerBuilder app and the author is no longer with company. The majority of the report is straightforward, but I am really hung up on...
1
2898
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 further to the right of the form than the form's default width - which may take up the entire screen for some users). The form contains panels which will contain either textboxes or datagridviews. The button is located on the menustrip towards...
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.