How to use ADO fast?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, does anyone have any opinions on data access functionality ?

What is the best way to use the data access components inside of Visual
Studio?
Do we drag and drop the components on the screen and link them to the
database, creating a dataset etc…?

Or is it more efficient and faster to create them at runtime?

Does anyone have any theories on what would allow for faster access to a
database ?
 
comments inline...
ARTMIC said:
Hello, does anyone have any opinions on data access functionality ?

What is the best way to use the data access components inside of Visual
Studio?
----You can use the designer and it is probably the fastest way to build
your application. however, there's a big trade off here. For one thing,
you'll be talking directly to the database a scenario which my friend Sahil
Malik refers to as as a "Cowboy" application in his wonderful new book
http://shrinkster.com/9y1 . So is this the 'best' way? It really depends
on how you define 'best' but in most every sense of the word I'd have to
answer NO!
Do we drag and drop the components on the screen and link them to the
database, creating a dataset etc.?
- You can. But you will probably want to create real business objects and
while you can use a dataset as a business object, whether or not you want to
is a different story. Again, I'd point to some of Sahil's wisdom for
guidance
http://codebetter.com/blogs/sahil.malik/archive/2005/06/07/64172.aspx .
Unless your application and table design is very straightforward, using only
the designer for your components probably won't work for you.
Or is it more efficient and faster to create them at runtime?
--Efficient in what sense? If you want to have an application that scales,
almost across the board I'd say NO. Using the designer also has a lot of
other issues that you can work around, but by the time you work around them
you might as well have rolled out your own. For isntance, in a web
application (or winforms for that matter), would you really want to hard
code your connection string inside the application? Of, you can use the
designer and still store this in the config file, but wyould you want to
publish your username and password in plaintext? Probably not. So you'd
encrypt and decrypt them, but then you'd have to put in some custom code and
little by little the 'benefits' of using a pure designer approach would be
diminished . In the same respect, you won't be able to set up an
application server or use remoting right off the bat if you use only the
designer. So these will help you get the app built faster, but it's not
done until it's done (I know, that's a brilliant observation) so it needs to
scale and perform and be secure and all that other jazz before it's really
done, and it's hard for me to imagine a real non-trivial production app that
was built purely with the designer.
Does anyone have any theories on what would allow for faster access to a
database ?
For one thing I'd recommend the data Access Application Block /Enterprise
Library
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/daab.asp
Also, if RAD is a primary goal, I'd look to using an O/R Mapper. Take a
look at LLBLGen Pro http://www.llblgen.com/defaultgeneric.aspx. Another
fine product is www.deklarit.com and I've recently come across NJDX by
Software Tree that's a great tool. All of these tools can cut a tremendous
amount of time out of development and if you look at LLBLGenPro for
isntance, Frans Bouma the lead architect on it frequents these newsgroups
and blogs regularly. You wont' find anything but rave reviews about
LLBLGenPro and if you look at their customer list, that's saying a lot.
Anything that has 100% user love is a safe bet. I'd look at the demos each
company has and see which one fits your needs best, they all do things
slightly differently so it's not exactly and apples to apples comparison,
but I feel 100% comfortable recommending any of them to you as I know so
many people that love each of them.
 
Thank you for the answer W.G.
I will take a look at the tools and the book.
Right now i've been using C# to create classes of my tables and loading and
saving the info through internal sql commands, without much use of datasets.
Thanks.
 
Bill,
For isntance, in a web application (or winforms for that matter), would
you really want to hard code your connection string inside the
application?

What is the problem with that Bill. I find it much saver to have a
connectionstring in an application than in a config file. However, maybe I
oversee something?

Cor
 
Bill,

By the way, the designer creates now in 2.0 connection strings in config
files. I thought that it was better to write that myself.

:-)

Cor
 
Artmic,

In addition to Bill, the advance in a strongly typed dataset situation
(using the designer) can be that you have the schemas in your program and
that they don't have to be got from the server in advance.

However think always for what you are the most comfortable with and as well
how large is your development team. The process time is mostly something the
user does not notice. (Think at the normal natural wait moments from users).

Another thing is, that in my opinion if there are only 1 to 3 developers
than there is less need for strongly typed reusable classes which needs no
knowledge of the database.

Just my thought,

Cor
 
The main thing is that if you hard code it, then you have to have a separate
build for each copy of the application you deploy for each client. I find it
a lot easier to just have it created in the setup project. To a lesser
degree, you can change things if the server name changes, but that doesn't
happen all that often. However it's typical to have multiple dbs for test,
staging and production so being able to switch it in the config file makes
that process easier. I also have had scenarios where I'd have specific
developer config files that the app config points to. When they arne't
present it uses the app config setting, otherwise it uses the user's config
file. In large teams where you're at different locations, this was a
lifesaver b/c the class that would otherwise contain the connection string
may be checked out and you wouldn't have access to it.
 
Bill,

I let the windowsform text (sorry) I did mean a webform, in a windowform we
agree. A webapplication is not something that you so often standard deploy
in my opinion.

Cor
 
Miha,
Cor, hardcoding connection string is silly by any mean, trust us.

Do you know a saver place than in a DLL in the Bin directory for a webserver
for that.
(Yes I know one the registry of such a server).

However a lot of people use for ASPNET scripting .Net. In that case it is
the worst place to put your connection string.

Cor

Miha Markic said:
Cor, hardcoding connection string is silly by any mean, trust us.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Cor Ligthert said:
Bill,

I let the windowsform text (sorry) I did mean a webform, in a windowform
we agree. A webapplication is not something that you so often standard
deploy in my opinion.

Cor
 
Personally, on the web scenario I like using a Salted/Hashed password in
..config. I used to do the Registry thing but a lot of our clients don't
want us writing to the registry if at all possible. Most of the winforms
apps I work on use Remoting heavily so we are already doing a lot with
config files. by the time you throw in the application blocks, it's often a
good fit to throw in the connection manager as well in the config.

I'm not saying this way is the best by any means, just the one I prefer. If
you don't mind me asking, what are the primary benefits in your opinion to
coding it in the dll?
Cor Ligthert said:
Miha,
Cor, hardcoding connection string is silly by any mean, trust us.

Do you know a saver place than in a DLL in the Bin directory for a
webserver for that.
(Yes I know one the registry of such a server).

However a lot of people use for ASPNET scripting .Net. In that case it is
the worst place to put your connection string.

Cor

Miha Markic said:
Cor, hardcoding connection string is silly by any mean, trust us.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Cor Ligthert said:
Bill,

I let the windowsform text (sorry) I did mean a webform, in a windowform
we agree. A webapplication is not something that you so often standard
deploy in my opinion.

Cor
 
Bill,

Even if it is downloaded because a misplaced security in the directory, than
it is in my opinion harder to get the connectionstring from the DLL than
from the config.sys

I am not so sure that every administrator set all rights in the correct way
(The main belongs to ASPNET, however the Bin should have other rights).

Downloading config.sys from an open bin directory is a piece of cake. If it
is in a dll, than your first chalenge is to know the name of it. Than you
have to know about ILS and than you can find (for not Net specials with a
lot of work) the configstring somewhere between that ILS code.

Therefore I have the idea that a connectionstring in a DLL on a webserver is
at least not less save than in a config.file.

If the situation is that you have to deploy almost exactly the same website
a lot of times than the config is of course a better approach, however not
for security reason but for deployment reason. However see what I wrote
about this before in this message thread.

Cor
 
It is still silly - hardcoding is never a good option even with one time
deployment.
There are other protection mechanisms like encryption.
And heck, if the system admin (or web admin) opens the access to the web
server than no hardcoding will help him/her.
 
I prefer encryption to. In the old days it was different, but the first
time I saw reflector show me my code clear as day, that changed all that for
me
Miha Markic said:
It is still silly - hardcoding is never a good option even with one time
deployment.
There are other protection mechanisms like encryption.
And heck, if the system admin (or web admin) opens the access to the web
server than no hardcoding will help him/her.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Cor Ligthert said:
Bill,

Even if it is downloaded because a misplaced security in the directory,
than it is in my opinion harder to get the connectionstring from the DLL
than from the config.sys

I am not so sure that every administrator set all rights in the correct
way (The main belongs to ASPNET, however the Bin should have other
rights).

Downloading config.sys from an open bin directory is a piece of cake. If
it is in a dll, than your first chalenge is to know the name of it. Than
you have to know about ILS and than you can find (for not Net specials
with a lot of work) the configstring somewhere between that ILS code.

Therefore I have the idea that a connectionstring in a DLL on a webserver
is at least not less save than in a config.file.

If the situation is that you have to deploy almost exactly the same
website a lot of times than the config is of course a better approach,
however not for security reason but for deployment reason. However see
what I wrote about this before in this message thread.

Cor
 
Even safer is to use windows authentication if possible.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

W.G. Ryan - MVP said:
I prefer encryption to. In the old days it was different, but the first
time I saw reflector show me my code clear as day, that changed all that
for me
Miha Markic said:
It is still silly - hardcoding is never a good option even with one time
deployment.
There are other protection mechanisms like encryption.
And heck, if the system admin (or web admin) opens the access to the web
server than no hardcoding will help him/her.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Cor Ligthert said:
Bill,

Even if it is downloaded because a misplaced security in the directory,
than it is in my opinion harder to get the connectionstring from the DLL
than from the config.sys

I am not so sure that every administrator set all rights in the correct
way (The main belongs to ASPNET, however the Bin should have other
rights).

Downloading config.sys from an open bin directory is a piece of cake. If
it is in a dll, than your first chalenge is to know the name of it. Than
you have to know about ILS and than you can find (for not Net specials
with a lot of work) the configstring somewhere between that ILS code.

Therefore I have the idea that a connectionstring in a DLL on a
webserver is at least not less save than in a config.file.

If the situation is that you have to deploy almost exactly the same
website a lot of times than the config is of course a better approach,
however not for security reason but for deployment reason. However see
what I wrote about this before in this message thread.

Cor
 
Bill,

I agree that it encrypting secures even more, however be aware that all keys
can be in the same way reachable for the hacker as it is in the other
situations.

I prefer to set the connectionstring and all things around it on a place
where it is unreachable for the hacker and than should any extra be
unnecessary. (However see where I wrote in this thread how I think that it
probably in much cases is and therefore I agree with you that therefore
encrypting is a good extra to make it safer)

Just my opinion,

Cor
 
Cor Ligthert said:
Bill,

I agree that it encrypting secures even more, however be aware that all
keys can be in the same way reachable for the hacker as it is in the other
situations.

Everything might be reachable. Important is how easy it is reachable.
I prefer to set the connectionstring and all things around it on a place
where it is unreachable for the hacker and than should any extra be
unnecessary.

For example? Do you really think that hardcoding is not reachable...

(However see where I wrote in this thread how I think that it
 
For example? Do you really think that hardcoding is not reachable...
No that is just the fact where for I write this, see my answer to Bill in
this thread.

Cor
 
Back
Top