📄 ientitypersister.cs
字号:
bool HasIdentifierProperty { get; }
/// <summary>
/// Determine whether detahced instances of this entity carry their own
/// identifier value.
/// </summary>
/// <returns>
/// True if either (1) <see cref="HasIdentifierProperty"/> or
/// (2) the identifier is an embedded composite identifier; false otherwise.
/// </returns>
/// <remarks>
/// The other option is the deprecated feature where users could supply
/// the id during session calls.
/// </remarks>
bool CanExtractIdOutOfEntity { get; }
/// <summary>
/// Determine whether this entity defines a natural identifier.
/// </summary>
/// <returns> True if the entity defines a natural id; false otherwise. </returns>
bool HasNaturalIdentifier { get; }
/// <summary>
/// Retrieve the current state of the natural-id properties from the database.
/// </summary>
/// <param name="id">
/// The identifier of the entity for which to retrieve the naturak-id values.
/// </param>
/// <param name="session">
/// The session from which the request originated.
/// </param>
/// <returns> The natural-id snapshot. </returns>
object[] GetNaturalIdentifierSnapshot(object id, ISessionImplementor session);
/// <summary>
/// Determine whether this entity defines any lazy properties (ala
/// bytecode instrumentation).
/// </summary>
/// <returns>
/// True if the entity has properties mapped as lazy; false otherwise.
/// </returns>
bool HasLazyProperties { get; }
/// <summary>
/// Load an instance of the persistent class.
/// </summary>
object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session);
/// <summary>
/// Do a version check (optional operation)
/// </summary>
void Lock(object id, object version, object obj, LockMode lockMode, ISessionImplementor session);
/// <summary>
/// Persist an instance
/// </summary>
void Insert(object id, object[] fields, object obj, ISessionImplementor session);
/// <summary>
/// Persist an instance, using a natively generated identifier (optional operation)
/// </summary>
object Insert(object[] fields, object obj, ISessionImplementor session);
/// <summary>
/// Delete a persistent instance
/// </summary>
void Delete(object id, object version, object obj, ISessionImplementor session);
/// <summary>
/// Update a persistent instance
/// </summary>
/// <param name="id">The id.</param>
/// <param name="fields">The fields.</param>
/// <param name="dirtyFields">The dirty fields.</param>
/// <param name="hasDirtyCollection">if set to <see langword="true" /> [has dirty collection].</param>
/// <param name="oldFields">The old fields.</param>
/// <param name="oldVersion">The old version.</param>
/// <param name="obj">The obj.</param>
/// <param name="rowId">The rowId</param>
/// <param name="session">The session.</param>
void Update(object id, object[] fields, int[] dirtyFields, bool hasDirtyCollection, object[] oldFields,
object oldVersion, object obj, object rowId, ISessionImplementor session);
/// <summary>
/// Gets if the Property is updatable
/// </summary>
/// <value><see langword="true" /> if the Property's value can be updated.</value>
/// <remarks>
/// This is for formula columns and if the user sets the update attribute on the <property> element.
/// </remarks>
bool[] PropertyUpdateability { get; }
/// <summary>
/// Does this class have a cache?
/// </summary>
bool HasCache { get; }
/// <summary>
/// Get the current database state of the object, in a "hydrated" form, without resolving identifiers
/// </summary>
/// <param name="id"></param>
/// <param name="session"></param>
/// <returns><see langword="null" /> if select-before-update is not enabled or not supported</returns>
object[] GetDatabaseSnapshot(object id, ISessionImplementor session);
/// <summary>
/// Get the current version of the object, or return null if there is no row for
/// the given identifier. In the case of unversioned data, return any object
/// if the row exists.
/// </summary>
/// <param name="id"></param>
/// <param name="session"></param>
/// <returns></returns>
object GetCurrentVersion(object id, ISessionImplementor session);
object ForceVersionIncrement(object id, object currentVersion, ISessionImplementor session);
/// <summary> Try to discover the entity mode from the entity instance</summary>
EntityMode? GuessEntityMode(object obj);
/// <summary> Has the class actually been bytecode instrumented?</summary>
bool IsInstrumented(EntityMode entityMode);
/// <summary>
/// Does this entity define any properties as being database-generated on insert?
/// </summary>
bool HasInsertGeneratedProperties { get; }
/// <summary>
/// Does this entity define any properties as being database-generated on update?
/// </summary>
bool HasUpdateGeneratedProperties { get; }
#endregion
#region stuff that is tuplizer-centric, but is passed a session
/// <summary> Called just after the entities properties have been initialized</summary>
void AfterInitialize(object entity, bool lazyPropertiesAreUnfetched, ISessionImplementor session);
/// <summary> Called just after the entity has been reassociated with the session</summary>
void AfterReassociate(object entity, ISessionImplementor session);
/// <summary>
/// Create a new proxy instance
/// </summary>
/// <param name="id"></param>
/// <param name="session"></param>
/// <returns></returns>
object CreateProxy(object id, ISessionImplementor session);
/// <summary> Is this a new transient instance?</summary>
bool? IsTransient(object obj, ISessionImplementor session);
/// <summary> Return the values of the insertable properties of the object (including backrefs)</summary>
object[] GetPropertyValuesToInsert(object obj, IDictionary mergeMap, ISessionImplementor session);
/// <summary>
/// Perform a select to retrieve the values of any generated properties
/// back from the database, injecting these generated values into the
/// given entity as well as writing this state to the persistence context.
/// </summary>
/// <remarks>
/// Note, that because we update the persistence context here, callers
/// need to take care that they have already written the initial snapshot
/// to the persistence context before calling this method.
/// </remarks>
/// <param name="id">The entity's id value.</param>
/// <param name="entity">The entity for which to get the state.</param>
/// <param name="state">The entity state (at the time of Save).</param>
/// <param name="session">The session.</param>
void ProcessInsertGeneratedProperties(object id, object entity, object[] state, ISessionImplementor session);
/// <summary>
/// Perform a select to retrieve the values of any generated properties
/// back from the database, injecting these generated values into the
/// given entity as well as writing this state to the persistence context.
/// </summary>
/// <remarks>
/// Note, that because we update the persistence context here, callers
/// need to take care that they have already written the initial snapshot
/// to the persistence context before calling this method.
/// </remarks>
/// <param name="id">The entity's id value.</param>
/// <param name="entity">The entity for which to get the state.</param>
/// <param name="state">The entity state (at the time of Save).</param>
/// <param name="session">The session.</param>
void ProcessUpdateGeneratedProperties(object id, object entity, object[] state, ISessionImplementor session);
#endregion
#region stuff that is Tuplizer-centric
/// <summary>
/// The persistent class, or null
/// </summary>
System.Type GetMappedClass(EntityMode entityMode);
/// <summary>
/// Does the class implement the <c>ILifecycle</c> inteface?
/// </summary>
bool ImplementsLifecycle(EntityMode entityMode);
/// <summary>
/// Does the class implement the <c>IValidatable</c> interface?
/// </summary>
bool ImplementsValidatable(EntityMode entityMode);
/// <summary>
/// Get the proxy interface that instances of <c>this</c> concrete class will be cast to
/// </summary>
System.Type GetConcreteProxyClass(EntityMode entityMode);
/// <summary>
/// Set the given values to the mapped properties of the given object
/// </summary>
void SetPropertyValues(object obj, object[] values, EntityMode entityMode);
/// <summary>
/// Set the value of a particular property
/// </summary>
void SetPropertyValue(object obj, int i, object value, EntityMode entityMode);
/// <summary>
/// Return the values of the mapped properties of the object
/// </summary>
object[] GetPropertyValues(object obj, EntityMode entityMode);
/// <summary>
/// Get the value of a particular property
/// </summary>
object GetPropertyValue(object obj, int i, EntityMode entityMode);
/// <summary>
/// Get the value of a particular property
/// </summary>
object GetPropertyValue(object obj, string name, EntityMode entityMode);
/// <summary>
/// Get the identifier of an instance ( throw an exception if no identifier property)
/// </summary>
object GetIdentifier(object obj, EntityMode entityMode);
/// <summary>
/// Set the identifier of an instance (or do nothing if no identifier property)
/// </summary>
/// <param name="obj">The object to set the Id property on.</param>
/// <param name="id">The value to set the Id property to.</param>
/// <param name="entityMode">The EntityMode</param>
void SetIdentifier(object obj, object id, EntityMode entityMode);
/// <summary>
/// Get the version number (or timestamp) from the object's version property (or return null if not versioned)
/// </summary>
object GetVersion(object obj, EntityMode entityMode);
/// <summary>
/// Create a class instance initialized with the given identifier
/// </summary>
object Instantiate(object id, EntityMode entityMode);
/// <summary>
/// Determines whether the specified entity is an instance of the class
/// managed by this persister.
/// </summary>
/// <param name="entity">The entity.</param>
/// <param name="entityMode">The EntityMode</param>
/// <returns>
/// <see langword="true"/> if the specified entity is an instance; otherwise, <see langword="false"/>.
/// </returns>
bool IsInstance(object entity, EntityMode entityMode);
/// <summary> Does the given instance have any uninitialized lazy properties?</summary>
bool HasUninitializedLazyProperties(object obj, EntityMode entityMode);
/// <summary>
/// Set the identifier and version of the given instance back
/// to its "unsaved" value, returning the id
/// </summary>
void ResetIdentifier(object entity, object currentId, object currentVersion, EntityMode entityMode);
/// <summary> Get the persister for an instance of this class or a subclass</summary>
IEntityPersister GetSubclassEntityPersister(object instance, ISessionFactoryImplementor factory, EntityMode entityMode);
#endregion
/// <summary>
/// Check the version value trough <see cref="VersionValue"/>.
/// </summary>
/// <param name="version">The snapshot entity state</param>
/// <returns>The result of <see cref="VersionValue.IsUnsaved"/>.</returns>
/// <remarks>NHibernate-specific feature, not present in H3.2</remarks>
bool? IsUnsavedVersion(object version);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -