473,507 Members | 2,545 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
GetContactsForCompany(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.Contacts.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 1298
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
NGetContactsForCompany(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.Contacts.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!7575E2FFC19135B4!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 connectionstring 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 connectionstring 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
14706
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...
13
2030
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...
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...
23
5698
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...
3
1516
by: zhaowei003x | last post by:
for all : who are the best experts for c in the world?why ?what are they doing now?
102
5316
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...
40
1677
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...
6
1410
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...
0
7223
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
7110
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...
0
7314
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,...
1
5041
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
4702
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...
0
3191
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...
0
1540
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
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...

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.