Re: Your opinion please
- From: "Dave Sexton" <dave@jwa[remove.this]online.com>
- Date: Wed, 29 Nov 2006 14:46:26 -0500
Hi Lucian,
You should provide a method or property that allows the calling code to
check whether credentials are required so that it may prompt the user for
them, if necessary, and avoid an exception. A method named,
"RequiresCredentials" or a property named, "CredentialsRequired" sounds
reasonable to me.
I don't know... Think of this code:
bool isreq = db.CredentialsRequired();
if (isreq) db.Login(GetLoginInfo());
db.Access();
I envisioned the code to look more like this:
Database db = new Database(connString);
bool secure = db.RequiresCredentials();
// or
// bool secure = db.CredentialsRequired;
if (secure)
db.Open(GetUserCredentials());
else
db.Open();
Where's the problem here?
What happens if an administrator imposes a security requirement while
this thread is just part way through? Then the db.Access() call will
fail with the access fault. So you're going to need to handle the
access fault in any case.
Multi-threading issues are an entirely different thing to consider. I
assume that the Database class will be immutable in that respect. It
doesn't make sense to change whether or not a connection requires
credentials asynchronously, IMO.
--
Dave Sexton
.
- Follow-Ups:
- Re: Your opinion please
- From: ssamuel
- Re: Your opinion please
- From: Lucian Wischik
- Re: Your opinion please
- References:
- Your opinion please
- From: C# Beginner
- Re: Your opinion please
- From: Dave Sexton
- Re: Your opinion please
- From: Lucian Wischik
- Your opinion please
- Prev by Date: Re: Fastest way to convert an object to a string
- Next by Date: .NET Grammar modification
- Previous by thread: Re: Your opinion please
- Next by thread: Re: Your opinion please
- Index(es):