Domanda

Is there a way to do a read uncommitted when using Rob Conery's Massive without writing your own query?

It is for a site that is mostly read-only. A CMS type of a site.

È stato utile?

Soluzione

The cheat way to do this is when you are doing your declaration for the table. Pass in a (nolock) hint:

var dirtytbl = new DynamicModel("northwind", tableName:"dbo.Products (nolock)", primaryKeyField:"ProductID");

If you don't want to have established dirty models and clean models, for the what I hope to be rare times you are doing this, you can just go straight to SQL:

var dirtyresult = tbl.Fetch("set transaction isolation level read uncommitted; SELECT * FROM Categories c INNER JOIN things t on c.id = t.id ");

I use the above code for system objects and some other behind the scenes stuff where I know it won't matter, but you should always be very cautious and know what you are getting into when you drop to that isolation level. See blog post How dirty are your reads?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top