本文整理汇总了C#中LockMode类的典型用法代码示例。如果您正苦于以下问题:C# LockMode类的具体用法?C# LockMode怎么用?C# LockMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LockMode类属于命名空间,在下文中一共展示了LockMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CollectionFetchReturn
public CollectionFetchReturn(string alias, NonScalarReturn owner, string ownerProperty,
ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases,
LockMode lockMode) : base(owner, ownerProperty, alias, lockMode)
{
this.collectionAliases = collectionAliases;
this.elementEntityAliases = elementEntityAliases;
}
开发者ID:KaraokeStu,项目名称:nhibernate-core,代码行数:7,代码来源:CollectionFetchReturn.cs
示例2: SQLQueryJoinReturn
public SQLQueryJoinReturn(string alias, string ownerAlias, string ownerProperty, IDictionary propertyResults,
LockMode lockMode)
: base(alias, propertyResults, lockMode)
{
this.ownerAlias = ownerAlias;
this.ownerProperty = ownerProperty;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:SQLQueryJoinReturn.cs
示例3: InitStatementString
private void InitStatementString(SqlString projection,SqlString condition,
string orderBy,string groupBy,LockMode lockMode)
{
int joins = CountEntityPersisters(associations);
Suffixes = BasicLoader.GenerateSuffixes(joins + 1);
JoinFragment ojf = MergeOuterJoins(associations);
SqlString selectClause = projection
??
new SqlString(persister.SelectFragment(alias, Suffixes[joins]) + SelectString(associations));
SqlSelectBuilder select = new SqlSelectBuilder(Factory)
.SetLockMode(lockMode)
.SetSelectClause(selectClause)
.SetFromClause(Dialect.AppendLockHint(lockMode, persister.FromTableFragment(alias)) +persister.FromJoinFragment(alias, true, true))
.SetWhereClause(condition)
.SetOuterJoins(ojf.ToFromFragmentString,ojf.ToWhereFragmentString + WhereFragment)
.SetOrderByClause(OrderBy(associations, orderBy))
.SetGroupByClause(groupBy);
if (Factory.Settings.IsCommentsEnabled)
select.SetComment(Comment);
SqlString = select.ToSqlString();
}
开发者ID:pallmall,项目名称:WCell,代码行数:25,代码来源:AbstractEntityJoinWalker.cs
示例4: InitProjection
protected void InitProjection(SqlString projectionString, SqlString whereString,
string orderByString, string groupByString, LockMode lockMode)
{
WalkEntityTree(persister, Alias);
Persisters = new ILoadable[0];
InitStatementString(projectionString, whereString, orderByString, groupByString, lockMode);
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:AbstractEntityJoinWalker.cs
示例5: wait
private void wait(LockMode mode)
{
WaitContext ctx;
lock (typeof(PersistentResource))
{
ctx = freeContexts;
if (ctx == null)
{
ctx = new WaitContext();
}
else
{
freeContexts = ctx.next;
}
ctx.next = null;
}
if (queueStart != null)
{
queueEnd = queueEnd.next = ctx;
}
else
{
queueStart = queueEnd = ctx;
}
ctx.mode = mode;
Monitor.Exit(this);
ctx.evt.WaitOne();
lock (typeof(PersistentResource))
{
ctx.next = freeContexts;
freeContexts = ctx;
}
}
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:35,代码来源:PersistentResource.cs
示例6: SQLQueryCollectionReturn
public SQLQueryCollectionReturn(string alias, string ownerClass, string ownerProperty, IDictionary propertyResults,
LockMode lockMode)
: base(alias, propertyResults, lockMode)
{
this.ownerEntityName = ownerClass;
this.ownerProperty = ownerProperty;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:SQLQueryCollectionReturn.cs
示例7: EntityLoader
public EntityLoader(
IOuterJoinLoadable persister,
string[] uniqueKey,
IType uniqueKeyType,
int batchSize,
LockMode lockMode,
ISessionFactoryImplementor factory,
IDictionary enabledFilters)
: base(persister, uniqueKeyType, factory, enabledFilters)
{
JoinWalker walker = new EntityJoinWalker(
persister,
uniqueKey,
uniqueKeyType,
batchSize,
lockMode,
factory,
enabledFilters
);
InitFromWalker(walker);
PostInstantiate();
batchLoader = batchSize > 1;
log.Debug("Static select for entity " + entityName + ": " + SqlString);
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:27,代码来源:EntityLoader.cs
示例8: InitAll
protected void InitAll(
SqlString whereString,
string orderByString,
LockMode lockMode)
{
WalkEntityTree(persister, Alias);
IList allAssociations = new ArrayList();
foreach (object obj in associations)
{
allAssociations.Add(obj);
}
allAssociations.Add(
new OuterJoinableAssociation(
persister.EntityType,
null,
null,
alias,
JoinType.LeftOuterJoin,
Factory,
CollectionHelper.EmptyMap
));
InitPersisters(allAssociations, lockMode);
InitStatementString(whereString, orderByString, lockMode);
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:25,代码来源:AbstractEntityJoinWalker.cs
示例9: RefreshEvent
public RefreshEvent(object entity, LockMode lockMode, IEventSource source)
: this(entity, source)
{
if (lockMode == null)
throw new ArgumentNullException("lockMode", "Attempt to generate refresh event with null lock mode");
this.lockMode = lockMode;
}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:8,代码来源:RefreshEvent.cs
示例10: InitStatementString
private void InitStatementString(
SqlString condition,
string orderBy,
LockMode lockMode)
{
InitStatementString(null, condition, orderBy, "", lockMode);
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:8,代码来源:AbstractEntityJoinWalker.cs
示例11: SimpleEntityLoader
public SimpleEntityLoader( ILoadable persister, SqlString sql, LockMode lockMode )
{
this.persister = new ILoadable[ ] {persister};
this.idType = persister.IdentifierType;
this.sql = sql;
this.lockMode = new LockMode[ ] {lockMode};
PostInstantiate();
}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:8,代码来源:SimpleEntityLoader.cs
示例12: DisposableReaderWriterLock
/// <summary>
/// .ctor
/// </summary>
/// <param name="alock">Lock to handle</param>
/// <param name="timeout">timeout to acquire lock</param>
/// <param name="mode">Lock mode</param>
public DisposableReaderWriterLock(ReaderWriterLock alock, TimeSpan timeout, LockMode mode = LockMode.Read)
{
ParametersValidator.IsNotNull(alock, ()=>alock);
_lock = alock;
_timeout = timeout;
_mode = mode;
AcquireLock();
Logger.TraceFormat("lock created timeout={0}, mode ={1}", timeout, mode);
}
开发者ID:sergey-prokofiev,项目名称:sp-tools,代码行数:15,代码来源:DisposableReaderWriterLock.cs
示例13: CollectionReturn
public CollectionReturn(string alias, string ownerEntityName, string ownerProperty,
ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases, LockMode lockMode)
: base(alias, lockMode)
{
this.ownerEntityName = ownerEntityName;
this.ownerProperty = ownerProperty;
this.collectionAliases = collectionAliases;
this.elementEntityAliases = elementEntityAliases;
}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:9,代码来源:CollectionReturn.cs
示例14: SetLockModeEvent
/**
* Construct a SetLockModeEvent
*
* @param methodSig tells us which overload of setLockMode to use
* @param lockMode the lock mode we'll set when the event fires
* @param alias the alias for which we'll set the lcok mode when the event
* fires. Can be null.
*/
private SetLockModeEvent(
MethodSig methodSig,
LockMode lockMode,
/*@Nullable*/ string alias)
{
this.methodSig = methodSig;
this.lockMode = lockMode;
this.alias = alias;
}
开发者ID:spib,项目名称:nhcontrib,代码行数:17,代码来源:SetLockModeEvent.cs
示例15: NonScalarReturn
public NonScalarReturn(string alias, LockMode lockMode)
{
this.alias = alias;
if (alias == null)
{
throw new HibernateException("alias must be specified");
}
this.lockMode = lockMode;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:9,代码来源:NonScalarReturn.cs
示例16: FillArray
public static LockMode[] FillArray(LockMode lockMode, int length)
{
LockMode[] result = new LockMode[length];
for (int i = 0; i < length; i++)
{
result[i] = lockMode;
}
return result;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:9,代码来源:ArrayHelper.cs
示例17: UpgradeLock
/// <summary>
/// Performs a pessimistic lock upgrade on a given entity, if needed.
/// </summary>
/// <param name="entity">The entity for which to upgrade the lock.</param>
/// <param name="entry">The entity's EntityEntry instance.</param>
/// <param name="requestedLockMode">The lock mode being requested for locking. </param>
/// <param name="source">The session which is the source of the event being processed.</param>
protected virtual void UpgradeLock(object entity, EntityEntry entry, LockMode requestedLockMode, ISessionImplementor source)
{
if (requestedLockMode.GreaterThan(entry.LockMode))
{
// The user requested a "greater" (i.e. more restrictive) form of
// pessimistic lock
if (entry.Status != Status.Loaded)
{
throw new ObjectDeletedException("attempted to lock a deleted instance", entry.Id, entry.EntityName);
}
IEntityPersister persister = entry.Persister;
if (log.IsDebugEnabled)
{
log.Debug(string.Format("locking {0} in mode: {1}", MessageHelper.InfoString(persister, entry.Id, source.Factory), requestedLockMode));
}
ISoftLock slock;
CacheKey ck;
if (persister.HasCache)
{
ck = new CacheKey(entry.Id, persister.IdentifierType, persister.RootEntityName, source.EntityMode, source.Factory);
slock = persister.Cache.Lock(ck, entry.Version);
}
else
{
ck = null;
slock = null;
}
try
{
if (persister.IsVersioned && requestedLockMode == LockMode.Force)
{
// todo : should we check the current isolation mode explicitly?
object nextVersion = persister.ForceVersionIncrement(entry.Id, entry.Version, source);
entry.ForceLocked(entity, nextVersion);
}
else
{
persister.Lock(entry.Id, entry.Version, entity, requestedLockMode, source);
}
entry.LockMode = requestedLockMode;
}
finally
{
// the database now holds a lock + the object is flushed from the cache,
// so release the soft lock
if (persister.HasCache)
{
persister.Cache.Release(ck, slock);
}
}
}
}
开发者ID:ray2006,项目名称:WCell,代码行数:63,代码来源:AbstractLockUpgradeEventListener.cs
示例18: EntityFetchReturn
public EntityFetchReturn(
String alias,
IEntityAliases entityAliases,
NonScalarReturn owner,
String ownerProperty,
LockMode lockMode)
: base(owner, ownerProperty, alias, lockMode)
{
this.entityAliases = entityAliases;
}
开发者ID:zibler,项目名称:zibler,代码行数:10,代码来源:EntityFetchReturn.cs
示例19: RootReturn
public RootReturn(
String alias,
String entityName,
IEntityAliases entityAliases,
LockMode lockMode)
: base(alias, lockMode)
{
this.entityName = entityName;
this.entityAliases = entityAliases;
}
开发者ID:zibler,项目名称:zibler,代码行数:10,代码来源:RootReturn.cs
示例20: FetchReturn
public FetchReturn(
NonScalarReturn owner,
string ownerProperty,
string alias,
LockMode lockMode)
: base(alias, lockMode)
{
this.owner = owner;
this.ownerProperty = ownerProperty;
}
开发者ID:zibler,项目名称:zibler,代码行数:10,代码来源:FetchReturn.cs
注:本文中的LockMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论