score:0
did you tried this ?
transactionoptions.timeout = transactionmanager.maximumtimeout;
score:1
using (var trans = new transactionscope(
transactionscopeoption.required,
new transactionoptions
{
isolationlevel = isolationlevel.readuncommitted
}
))
{
// your linq to sql query goes here where you read some data from db
}
while updating tables (inserting, deleting or updating), they become locked, so if you want to read the data, which is not yet commit, so, you can use transaction isolationlevel.readuncommitted to allow dirty reads
score:2
yes, if you start a transaction that manipulates lots of records, and takes a long time to complete, then as a direct result competing operations will be blocked. this is especially true for "serializable" transactions, since they take the most locks (including key-range locks etc). this is the nature of a transaction; it is the i in acid.
options:
- don't do everything in one huge transaction
- have your read operations intentionally read past the locks (this is hugely double-edged - can be fine, but can cause big problems - treat with caution) - for example
nolock
orread uncommitted
. - on full sql server (not ce), try using snapshot isolation
Source: stackoverflow.com
Related Query
- Transaction and TransactionScope isolation
- TransactionScope vs Transaction in LINQ to SQL
- Entity Framework, Code First and Full Text Search
- What does this C# code with an "arrow" mean and how is it called?
- How to count the number of code lines in a C# solution, without comments and empty lines, and other redundant stuff, etc?
- I am wondering about the state of connection and impact on code performance by 'yield' while iterating over data reader object
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- LINQ Source Code Available
- Refactor Linq code and "LINQ to Entities does not recognize the method"
- .NET 4 Code Contracts: "requires unproven: source != null"
- Performance tuning C# permutations and SHA1 code
- What is the difference between ((IEnumerable)source).OfType<T>() and source as IEnumerable<T>
- How can I code an outer join using LINQ and EF6?
- Avoid extra loop and could not find implementation of query pattern for source type int Select not found
- Why not reveal the type and identity of the source to the client?
- LINQ to SQL transaction and read ID of inserted record
- C# - Linq optimize code with List and Where clause
- IEqualityComparer and Linq Distinct - Hard Code GetHashCode()
- EF Code first Eager loading and OrderBy problem
- Code Example for Add DateTime and TimeSpan in EF query
- creating Linq to sqlite dbml from DbLinq source code
- Stubbing Code for Test With Linq Expressions and Lambdas
- Can I prevent a LINQ DataContext from using a transaction when a TransactionScope is present?
- How to get and use source of grouping in LINQ?
- Handling very large strings between SQL Server and .NET code +LINQ
- SQL subquery result in LINQ and Entity Framework Code First
- TransactionScope, linq and strange transaction manager issue (HRESULT: 0x8004D024)
- How to change the precision and the scale of decimal globally through code first?
- Code Rewite for tuple and if else statements by using LINQ
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
More Query from same tag
- Cannot create simple Service Operation in (WCF Data Services)
- Create custom object from List<T> using .Linq
- How to find the difference between 2 list models
- HtmlAgilityPack SelectNode doesn't works on WP8.1
- How To Sort A List With Dynamic Objects
- How to project list of objects into nested object list
- Displaying Related Data In A Special Format
- Determine type in return Enumerable.Range()
- Linq to entity - exclude children based on childs grandchildren
- Use LinqKit PredicateBuilder for related model (EF Core)
- Handling Exchange Web Services (EWS) missing properties
- Perform multiple left joins using Linq
- Multiple joins using linq
- Convert LINQ in query syntax to lambda syntax
- foreach after Linq query on a datatable not working
- Set Attribute to ListItem in Linq Query
- Entity Framework 5 - Get non related / navigable entities
- How to Union Different Types in Linq-2-Entity
- Extracting Items over an List<T> of List<T>
- Use LINQ to remove the first column in a DatagGridView for each control in a ControlCollection
- Sorting and Grouping List data
- LINQ Weirdness with joining tables
- LINQ error invalid initializer member declarator
- Remove Element From String Array Using LINQ Contains Value
- Linq query & generics
- linq inner join sub query and conditional select
- Linq: Get Item which is in a list which also is in a list
- How to load XML data to a data structure?
- Efficient method of merging multiple lists based on item weights
- LINQ to SQL classes to my own classes