[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Configuration locking

Ralf

10/14/2008 4:28:00 PM

Hi,

in an application I'm using a non trivial configuration,
implemented with classes from the System.Configuration namespace.
The parameters will be written to the app.exe.config file.
My application is stored on a network device and can be used from
more than one user at the same time.
To prevent the parameters for competing access, I want to lock
the parameters during one user is editing these parameters.

The ConfigurationElement class has lock functionality:
ConfigurationElement.LockItem.
But I can't find any background informations about the locking mechanism.

Does anyone works with the locking mechanism?
I have a few questions about this:

1. Can I use LockItem for multi user locking?
2. How can I get the information which user is locking the parameters at the
moment?
3. How can I manually unlock the parameters if a lock is lost?
4. How does it work?
5. Is there a better way for configuration locking?

Regards
Ralf

3 Answers

Cowboy

10/14/2008 8:28:00 PM

0

The lock works quite a bit like a lock on a thread, only there is far less
information you can get from it. If you want something more full featured,
you will have to build your own. Before doing that, consider the next
question and response very carefully:

How often are you updating configs on a multi-user application? If the
values you are looking at are routinely changed, they would be better in a
persistant store than a configuration file.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/Greg...

or just read it:
http://feeds.feedburner.com/Gre...

********************************************
| Think outside the box! |
********************************************
"Ralf" <Ralf@community.nospam> wrote in message
news:uhjgInhLJHA.1156@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> in an application I'm using a non trivial configuration,
> implemented with classes from the System.Configuration namespace.
> The parameters will be written to the app.exe.config file.
> My application is stored on a network device and can be used from
> more than one user at the same time.
> To prevent the parameters for competing access, I want to lock
> the parameters during one user is editing these parameters.
>
> The ConfigurationElement class has lock functionality:
> ConfigurationElement.LockItem.
> But I can't find any background informations about the locking mechanism.
>
> Does anyone works with the locking mechanism?
> I have a few questions about this:
>
> 1. Can I use LockItem for multi user locking?
> 2. How can I get the information which user is locking the parameters at
> the moment?
> 3. How can I manually unlock the parameters if a lock is lost?
> 4. How does it work?
> 5. Is there a better way for configuration locking?
>
> Regards
> Ralf

Ralf

10/15/2008 7:18:00 PM

0

Hi Cowboy,

thanx for your answer,

> How often are you updating configs on a multi-user application? If the
> values you are looking at are routinely changed, they would be better in a
> persistant store than a configuration file.

Normally the parameter will changed once per month.
So the use of a database makes no sense.
Although it is possible that two user are changing the parameters at the
same time.

Regards
Ralf

Naked Gonad

11/24/2008 2:23:00 PM

0

Eli Grubman wrote:
> On Mon, 24 Nov 2008 12:51:30 +0000, Naked Gonad
> <bodron57@tiscali.co.uk> wrote:
>
>> Eli Grubman wrote:
>>> On Mon, 24 Nov 2008 11:56:11 +0000, Naked Gonad
>>> <bodron57@tiscali.co.uk> wrote:
>>>
>>>> Eli Grubman wrote:
>>>>> On Mon, 24 Nov 2008 11:25:53 +0000, Naked Gonad
>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>
>>>>>> Eli Grubman wrote:
>>>>>>> On Mon, 24 Nov 2008 09:19:04 +0000, Naked Gonad
>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>
>>>>>>>> Eli Grubman wrote:
>>>>>>>>> On Tue, 18 Nov 2008 09:38:06 +0000, Naked Gonad
>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>
>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>> On Mon, 17 Nov 2008 18:43:24 +0000, Naked Gonad
>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>> On Mon, 17 Nov 2008 17:14:03 +0000, Naked Gonad
>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 16:18:51 +0000, Naked Gonad
>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 15:24:06 +0000, Naked Gonad
>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 14:30:18 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 13:48:22 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 11:58:37 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 11:34:35 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 09:43:44 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sun, 16 Nov 2008 19:17:03 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sun, 16 Nov 2008 18:39:24 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sat, 15 Nov 2008 20:04:12 -0000, Naked Gonad <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Peter Hucker wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Fri, 14 Nov 2008 23:28:25 -0000, Eli Grubman <eli.grubman@googlemail.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Fri, 14 Nov 2008 18:33:50 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, 13 Nov 2008 04:15:28 -0000, Eli Grubman <eli.grubman@googlemail.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Wed, 12 Nov 2008 18:53:55 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Tue, 11 Nov 2008 19:33:48 -0000, Naked Gonad <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Peter Hucker wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Nought is accepted as meaning nothing generally.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> In a bank account 0 or 0 recurring=nothing, try convincing
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> the bank that the 0 counts as anything more than nothing.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> It is not the same as nothing. An empty bank account is not the same as no bank account.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> One is as useless as the other.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Not if you have an overdraft agreement.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> That's even worse.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Rubbish. Take the banks for all they've got!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> That's silly, an overdraft generates interest, doesn't it?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> So you lose.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Why do you think i have 12 bank accounts?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> You mean you cover overdrafts in one accounf with cheques on another,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> which are in turn covered by cheques on a third? That's known as
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "kiting" in the trade.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Or, flying by the seat of your pants.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Once you lose your shirt, the pants are next!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>> Always wear clean underwear!
>>>>>>>>>>>>>>>>>>>>>>>>>>> If they're going to take those too, why make it pleasant for them?
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>> Dirty pants = a dirty mind.
>>>>>>>>>>>>>>>>>>>>>>>>> You almost make that sound like a Bad Thing?.
>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> No, just pointing it out.
>>>>>>>>>>>>>>>>>>>>>>> It is, of course, a Good Thing?.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Extreme filth!
>>>>>>>>>>>>>>>>>>>>> One hopes and prays.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Bring back debauchery.
>>>>>>>>>>>>>>>>>>> It left?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Only temporarily.
>>>>>>>>>>>>>>>>> Thank fuck for that!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I do so enjoy a good bit of pillaging.
>>>>>>>>>>>>>>> Rape's good too.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Also good exercise.
>>>>>>>>>>>>> The ideal combination.
>>>>>>>>>>>>>
>>>>>>>>>>>> Keeeeeeeeeeeeeeep bonking!!
>>>>>>>>>>> You know it makes sense.
>>>>>>>>>>>
>>>>>>>>>> Clunk click, you've bent your dick!
>>>>>>>>> I knew there was something wrong with that Savile character.
>>>>>>>>>
>>>>>>>> Now then!...now then!!
>>>>>>> Smoking cigars is bad for your hair.
>>>>>>>
>>>>>> But keeps the flies away.
>>>>> Keeps just about everyone/everything away.
>>>>>
>>>> A good smokescreen for most things then?
>>> Smoke 'n mirrors.
>>>
>> It's just magic.
>
> Now you see it, now you don't.
>
It's behind you!