O
Omatase
I have a data in a table that I need to read once and only once. I
will have multiple instances of my application accessing this database
potentially at the same time (because my application is WCF service
hosted by IIS) but no two instances of this application should access
the same rows of data even on reads.
If I were in TSQL I could just do an XLOCK, ROWLOCK to lock the row on
a SELECT but I can't find any way to lock on a SELECT in linqtosql. I
know I can use TransactionScope to provide an isolation level but none
of the isolation levels will take an exclusive lock on a select
statement. While SERIALIZABLE seems to provide this functionality from
the description on Microsoft's site, in practice (I tested it in
Management Studio) it does not.
My questions are is there a way to take an exclusive lock on a SELECT
in pure LINQ or is there a way I can manage my concurrency directly in
the C# code? I haven't done anything with C# object transactioning and
I don't know if it can satisfy my requirement since I don't know how I
can share data across different instances of my WCF service and am not
really even sure a singleton or static class would accommodate me in
this situation.
Thanks for any help
will have multiple instances of my application accessing this database
potentially at the same time (because my application is WCF service
hosted by IIS) but no two instances of this application should access
the same rows of data even on reads.
If I were in TSQL I could just do an XLOCK, ROWLOCK to lock the row on
a SELECT but I can't find any way to lock on a SELECT in linqtosql. I
know I can use TransactionScope to provide an isolation level but none
of the isolation levels will take an exclusive lock on a select
statement. While SERIALIZABLE seems to provide this functionality from
the description on Microsoft's site, in practice (I tested it in
Management Studio) it does not.
My questions are is there a way to take an exclusive lock on a SELECT
in pure LINQ or is there a way I can manage my concurrency directly in
the C# code? I haven't done anything with C# object transactioning and
I don't know if it can satisfy my requirement since I don't know how I
can share data across different instances of my WCF service and am not
really even sure a singleton or static class would accommodate me in
this situation.
Thanks for any help