本文整理汇总了C#中IEntityPersister类的典型用法代码示例。如果您正苦于以下问题:C# IEntityPersister类的具体用法?C# IEntityPersister怎么用?C# IEntityPersister使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEntityPersister类属于命名空间,在下文中一共展示了IEntityPersister类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
private void Set(IEntityPersister persister, object[] state, string propertyName, object value)
{
var index = Array.IndexOf(persister.PropertyNames, propertyName);
if (index == -1)
return;
state[index] = value;
}
示例2: ScheduledInsertion
/// <summary>
/// Initializes a new instance of <see cref="ScheduledInsertion"/>.
/// </summary>
/// <param name="id">The identifier of the object.</param>
/// <param name="state">An object array that contains the state of the object being inserted.</param>
/// <param name="instance">The actual object instance.</param>
/// <param name="version">The version of the object instance.</param>
/// <param name="persister">The <see cref="IEntityPersister"/> that is responsible for the persisting the object.</param>
/// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param>
public ScheduledInsertion(object id, object[] state, object instance, object version, IEntityPersister persister,
ISessionImplementor session)
: base(session, id, instance, persister)
{
this.state = state;
this.version = version;
}
示例3: GetAdditionalDirtyProperties
private static IEnumerable<int> GetAdditionalDirtyProperties(IEntityPersister persister)
{
// Always update audit fields, even if their values don't change (dynamic-update=true would prevent this, hence this 'hack')
var auditingInfoPropertyIndex = Array.IndexOf(persister.PropertyNames, "AuditingInfo");
if (auditingInfoPropertyIndex != -1)
yield return auditingInfoPropertyIndex;
}
开发者ID:stevenlauwers22,项目名称:NHibernate.QFrameBootcamp,代码行数:7,代码来源:AuditingFlushEntityEventListener.cs
示例4: Reassociate
/// <summary>
/// Associates a given entity (either transient or associated with another session) to the given session.
/// </summary>
/// <param name="event">The event triggering the re-association </param>
/// <param name="entity">The entity to be associated </param>
/// <param name="id">The id of the entity. </param>
/// <param name="persister">The entity's persister instance. </param>
/// <returns> An EntityEntry representing the entity within this session. </returns>
protected EntityEntry Reassociate(AbstractEvent @event, object entity, object id, IEntityPersister persister)
{
if (log.IsDebugEnabled)
{
log.Debug("Reassociating transient instance: " + MessageHelper.InfoString(persister, id, @event.Session.Factory));
}
IEventSource source = @event.Session;
EntityKey key = source.GenerateEntityKey(id, persister);
source.PersistenceContext.CheckUniqueness(key, entity);
//get a snapshot
object[] values = persister.GetPropertyValues(entity, source.EntityMode);
TypeHelper.DeepCopy(values, persister.PropertyTypes, persister.PropertyUpdateability, values, source);
object version = Versioning.GetVersion(values, persister);
EntityEntry newEntry = source.PersistenceContext.AddEntity(
entity,
persister.IsMutable ? Status.Loaded : Status.ReadOnly,
values,
key,
version,
LockMode.None,
true,
persister,
false,
true);
new OnLockVisitor(source, id, entity).Process(entity, persister);
persister.AfterReassociate(entity, source);
return newEntry;
}
示例5: Validate
protected virtual void Validate(object entity, IEntityPersister persister, IEventSource source)
{
if (persister.ImplementsValidatable(source.EntityMode))
{
((IValidatable)entity).Validate();
}
}
示例6: DelWorkUnit
public DelWorkUnit(ISessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg,
Object id, IEntityPersister entityPersister, Object[] state)
: base(sessionImplementor, entityName, verCfg, id)
{
this.state = state;
this.propertyNames = entityPersister.PropertyNames;
}
示例7: EntityIdentityInsertAction
public EntityIdentityInsertAction(object[] state, object instance, IEntityPersister persister, ISessionImplementor session, bool isDelayed)
: base(session, null, instance, persister)
{
this.state = state;
this.isDelayed = isDelayed;
delayedEntityKey = this.isDelayed ? GenerateDelayedEntityKey() : null;
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:7,代码来源:EntityIdentityInsertAction.cs
示例8: EntityDeleteAction
public EntityDeleteAction(object id, object[] state, object version, object instance, IEntityPersister persister, bool isCascadeDeleteEnabled, ISessionImplementor session)
: base(session, id, instance, persister)
{
this.state = state;
this.version = version;
this.isCascadeDeleteEnabled = isCascadeDeleteEnabled;
}
示例9: Update
public void Update(IAuditable auditable, object[] oldState, object[] state, IEntityPersister persister)
{
if (auditable == null)
return;
this.SetChange(auditable, state);
}
示例10: PreDeleteEvent
public PreDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister)
{
this.entity = entity;
this.id = id;
this.deletedState = deletedState;
this.persister = persister;
}
示例11: AbstractPreDatabaseOperationEvent
/// <summary> Constructs an event containing the pertinent information. </summary>
/// <param name="source">The session from which the event originated. </param>
/// <param name="entity">The entity to be invloved in the database operation. </param>
/// <param name="id">The entity id to be invloved in the database operation. </param>
/// <param name="persister">The entity's persister. </param>
protected AbstractPreDatabaseOperationEvent(IEventSource source, object entity, object id, IEntityPersister persister)
: base(source)
{
Entity = entity;
Id = id;
Persister = persister;
}
示例12: DetermineNameOfPropertyToUse
private static string DetermineNameOfPropertyToUse(IEntityPersister persister, string supplied)
{
if (supplied != null)
{
return supplied;
}
int[] naturalIdPropertyIndices = persister.NaturalIdentifierProperties;
if (naturalIdPropertyIndices == null)
{
throw new IdentifierGenerationException("no natural-id property defined; need to specify [key] in "
+ "generator parameters");
}
if (naturalIdPropertyIndices.Length > 1)
{
throw new IdentifierGenerationException("select generator does not currently support composite "
+ "natural-id properties; need to specify [key] in generator parameters");
}
ValueInclusion inclusion = persister.PropertyInsertGenerationInclusions[naturalIdPropertyIndices[0]];
if (inclusion != ValueInclusion.None)
{
throw new IdentifierGenerationException("natural-id also defined as insert-generated; need to specify [key] "
+ "in generator parameters");
}
return persister.PropertyNames[naturalIdPropertyIndices[0]];
}
示例13: InfoString
/// <summary>
/// Generate small message that can be used in traces and exception messages.
/// </summary>
/// <param name="persister">The <see cref="IEntityPersister" /> for the class in question.</param>
/// <param name="id">The identifier of the object.</param>
/// <param name="factory">The <see cref="ISessionFactory" />.</param>
/// <returns>A descriptive <see cref="String" /> in the format of <c>[classname#id]</c></returns>
public static string InfoString(IEntityPersister persister, object id, ISessionFactoryImplementor factory)
{
StringBuilder s = new StringBuilder();
s.Append('[');
if (persister == null)
{
s.Append("<null Class>");
}
else
{
s.Append(persister.EntityName);
}
s.Append('#');
if (id == null)
{
s.Append("<null>");
}
else
{
s.Append(id);
}
s.Append(']');
return s.ToString();
}
示例14: BatchingEntityLoader
public BatchingEntityLoader(IEntityPersister persister, int[] batchSizes, Loader[] loaders)
{
this.batchSizes = batchSizes;
this.loaders = loaders;
this.persister = persister;
idType = persister.IdentifierType;
}
示例15: Update
public void Update(IStampedEntity entity, object[] oldState,
object[] state, IEntityPersister persister)
{
if (entity == null)
return;
SetChange(entity, state, persister);
}