473,569 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

silly questions for an expert in OOP

Hi everyone, i have currently got a classic asp web application and am
wanting to upgrade it to asp.net 2.0, and also take advantage of OOP.
Our current application is not using OOP so you can imagine how hard it
is too upgrade.

I have read documentation all over the net, but still have some
questions (if anyone has any good documentation, i would love to read
it!!). i should warn you the questions maybe stupid/easy but i just
need to confirm that answer, so i know i am thinking along the correct
lines, or wrong lines as it may be. lol

1. My web application has many users, but not all users have the same
connection string to connect to their database. In order to keep the
each layer (data, business, presentation) separate, how could i go
about this?? I do not really want to pass the connectstring down each
layer, do i??

2. In my database, we have a company which has many contacts (one to
many relationship).
I have a Company function called GetByCompanyID, which returns a
company object
and i have a Contact function called GetByContactID, which returns a
contact object.

If i want to get all the contacts at a company, how do i go about it?
I do not want to repeat code, i gather i would create a function like
GetContactsForC ompany(id), which would extract the data from the
database and fill in a business object?

Once i have done that, do the child objects go into a collection class,
or should i reference them something like Company.Contact s.Item(x)?

3. I am trying to build the data access layer myself, as i really
dont want to some software doing it for me, so i know exactly how it
works etc. Does anyone know of a really good article, that also
explains about relationships and how to extract that data correctly?

I know that some of these questions really depend, on how the system is
setup, and maybe there is no right/wrong way, but i would really
appreicate your comments.

Cheers

Aug 14 '06 #1
3 1302
Hello Nemisis,

N1. My web application has many users, but not all users have the
Nsame connection string to connect to their database. In order to
Nkeep the each layer (data, business, presentation) separate, how
Ncould i go about this?? I do not really want to pass the
Nconnectstring down each layer, do i??

How this implemented now?
Why users need to know each own connection string?

NI have a Company function called GetByCompanyID, which returns a
Ncompany object
Nand i have a Contact function called GetByContactID, which returns a
Ncontact object.
NIf i want to get all the contacts at a company, how do i go about it?
NI do not want to repeat code, i gather i would create a function like
NGetContactsFor Company(id), which would extract the data from the
Ndatabase and fill in a business object?

If your business requirements is not clear just right now the best approach
might have be only one method
that will get the params of script which result u want to get.

NOnce i have done that, do the child objects go into a collection
Nclass, or should i reference them something like
NCompany.Contac ts.Item(x)?

It's up to you. Either the collection or DataSet/DataTable. First is more
flexible and fast, the second is a bit redundant and general.

I recomend to read this article http://msdn.microsoft.com/asp.net/de...CustEntCls.asp

N3. I am trying to build the data access layer myself, as i really
Ndont want to some software doing it for me, so i know exactly how it
Nworks etc. Does anyone know of a really good article, that also
Nexplains about relationships and how to extract that data correctly?

See there http://laflour.spaces. live.com/blog/cns!7575E2FFC19 135B4!245.entry

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 14 '06 #2

Michael Nemtsev wrote:
Hello Nemisis,

N1. My web application has many users, but not all users have the
Nsame connection string to connect to their database. In order to
Nkeep the each layer (data, business, presentation) separate, how
Ncould i go about this?? I do not really want to pass the
Nconnectstring down each layer, do i??

How this implemented now?
Why users need to know each own connection string?
Thanks for the advice and articles, i have read the microsoft articles
and i understand the concept alot better.

One question i still do have is about connection strings. Our users,
use different databases, but use the same web application, so as you
can gather each user at current has their connectionstrin g saved as a
session variable, so the correct database is used for that customer.

How would i go about this in my data layer, especially since i dont
want to pass any variables down tiers etc?? I dont really want to use
a session variable within the data layer, as my data tier maybe used in
windows applications in the future.

Aug 15 '06 #3
Hello Nemisis,

I'd recomend to incapsulate connection string (as i understand the login/pass
are too located on the client side)
on the side of web-services and set the user ID which will be assigned to
the specific connection string.

You can assign this ID to the several connection strings.

The idea is that users should know nothing about credentials, only admins
have to assign them to the desired resources/connections

NOne question i still do have is about connection strings. Our users,
Nuse different databases, but use the same web application, so as you
Ncan gather each user at current has their connectionstrin g saved as a
Nsession variable, so the correct database is used for that customer.
N>
NHow would i go about this in my data layer, especially since i dont
Nwant to pass any variables down tiers etc?? I dont really want to
Nuse a session variable within the data layer, as my data tier maybe
Nused in windows applications in the future.
N>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #4

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

Similar topics

162
14745
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple choice questions.etc.. I'll be indebted to everyone.. Thanks in advance.. regards vasant shetty Bangalore
13
2038
by: sieg1974 | last post by:
Hi, The function bellow returns the number of lines of a file. The length of the char variable __Line is 256, and I think it would allow me to store strings with up to 255 letters because the 256th character would always be "0". My question is why there is a segmentation fault when fseek tries to read 255 characters from the file if the...
4
263
by: Jenny | last post by:
Hi you al I have two very silly question The first one is In vb 6.0 you can add a procedure, sub or function, by clicking add procedure from the tools item on the menuba I cannot seem to find this in vb.net 2003 SV. My questions is do you have to manual enter the code to create a procedure yoursel And my sencond question Again in vb6 you...
23
5709
Niheel
by: Niheel | last post by:
In a word Please Don't OK I admit that was 2 words but nothing in software was ever specified properly. Here are the reasons why you should post in the forum rather than PMing a Community Expert You have no gaurantee that the expert you have PM'd knows anything about the subject you are asking about.
3
1520
by: zhaowei003x | last post by:
for all : who are the best experts for c in the world?why ?what are they doing now?
102
5364
by: dreamznatcher | last post by:
Hello, I'm considering a career switch to a more database-related job, but need help on a few questions and issues. I'm a Computer Engineering graduate and have always felt most comfortable creating database- driven applications, preferably for web portals. 1. What are the most viable career options for me out there? What profile do I...
40
1680
by: aarklon | last post by:
Hi all, I was reading the book "C interview Questions" By J. Rajaram published in india by firewall media, after going through the book i have the following doubts 1) why the following program is not showing compilation error in the lines no: of arguments in the function declaration and function definition do not match???
6
1413
by: jeddiki | last post by:
Hi, I am stuck again over something silly that I can not resolve. I am using a link to create a dynamic page. the link is itself written from the same same table that the dynamic page is written from, so the data must be ok (or the link wouldn't be there ) Anyway the link is : <a href="expert_disp.php?a=Dave" > &nbsp; Dave Casey </a>
0
7698
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...
1
7673
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...
0
7970
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...
0
6284
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...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
0
937
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...

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.