Hello,
I am using LL2.6.
I have a need to set a NOLOCK on a specific connection as well, not globally, due to some legacy code issues. Can anyone post a sample of their implementation of solution that Frans suggested in this thread?
I can't seem to get it to work.
For the subclassed dynamic query engine, I have created a new class in the database specific adapter project:
class CustomNoLockDynamicQueryEngine : SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine
{
public CustomNoLockDynamicQueryEngine(): base()
{
((SqlServerSpecificCreator)Creator).UseNoLockHintsForObjectNames = true;
}
}
I have then also created a separate NoLock DataAccessAdapter class for testing:
public class DataAccessAdapterNoLock : OneShop.Mc.DAL.DatabaseConnector.DataAccessAdapter
{
/// <summary>
/// CTor
/// </summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
public DataAccessAdapterNoLock(string connectionString)
: base(connectionString)
{
}
protected override SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase CreateDynamicQueryEngine()
{
//return base.CreateDynamicQueryEngine();
return new OneShop.Mc.DAL.DatabaseConnector.CustomNoLockDynamicQueryEngine();
}
}
My consuming code is then creating an instance of the new data access adapter class:
OneShop.Mc.DAL.DatabaseConnector.DataAccessAdapterNoLock dataAccessAdapter = new DataAccessAdapterNoLock(connectionString);
ScheduleEntity scheduleEntity = new ScheduleEntity(18646);
dataAccessAdapter.FetchEntity(scheduleEntity);
When I do this, data is retrieved, but when I put tracing in the app to check the sql that is emitted, it does not contain NOLOCk?
Help, anyone?
Thanks.
Can1