⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ientitypersister.cs

📁 NHibernate NET开发者所需的
💻 CS
📖 第 1 页 / 共 2 页
字号:
using NHibernate.Cache;
using NHibernate.Cache.Entry;
using NHibernate.Engine;
using NHibernate.Id;
using NHibernate.Metadata;
using NHibernate.Tuple.Entity;
using NHibernate.Type;
using System.Collections;

namespace NHibernate.Persister.Entity
{
	public struct EntityPersister
	{
		/// <summary> The property name of the "special" identifier property in HQL</summary>
		public readonly static string EntityID = "id";
	}

	/// <summary>
	/// Concrete <c>IEntityPersister</c>s implement mapping and persistence logic for a particular class.
	/// </summary>
	/// <remarks>
	/// Implementors must be threadsafe (preferably immutable) and must provide a constructor of type
	/// matching the signature of: (PersistentClass, SessionFactoryImplementor)
	/// </remarks>
	public interface IEntityPersister : IOptimisticCacheSource
	{
		/// <summary>
		/// The ISessionFactory to which this persister "belongs".
		/// </summary>
		ISessionFactoryImplementor Factory { get; }

		/// <summary> 
		/// Returns an object that identifies the space in which identifiers of
		/// this entity hierarchy are unique.
		/// </summary>
		string RootEntityName { get;}

		/// <summary>
		/// The entity name which this persister maps.
		/// </summary>
		string EntityName { get;}

		/// <summary> 
		/// Retrieve the underlying entity metamodel instance... 
		/// </summary>
		/// <returns> The metamodel </returns>
		EntityMetamodel EntityMetamodel { get;}

		/// <summary>
		/// Returns an array of objects that identify spaces in which properties of
		/// this entity are persisted, for instances of this class only.
		/// </summary>
		/// <returns>The property spaces.</returns>
		/// <remarks>
		/// For most implementations, this returns the complete set of table names
		/// to which instances of the mapped entity are persisted (not accounting
		/// for superclass entity mappings).
		/// </remarks>
		string[] PropertySpaces { get; }

		/// <summary>
		/// Returns an array of objects that identify spaces in which properties of
		/// this entity are persisted, for instances of this class and its subclasses.
		/// </summary>
		/// <remarks>
		/// Much like <see cref="PropertySpaces"/>, except that here we include subclass
		/// entity spaces.
		/// </remarks>
		/// <returns> The query spaces. </returns>
		string[] QuerySpaces { get; }

		/// <summary>
		/// Are instances of this class mutable?
		/// </summary>
		bool IsMutable { get; }

		/// <summary> 
		/// Determine whether the entity is inherited one or more other entities.
		/// In other words, is this entity a subclass of other entities. 
		/// </summary>
		/// <returns> True if other entities extend this entity; false otherwise. </returns>
		bool IsInherited { get;}

		/// <summary>
		/// Is the identifier assigned before the insert by an <c>IDGenerator</c> or is it returned
		/// by the <c>Insert()</c> method?
		/// </summary>
		/// <remarks>
		/// This determines which form of <c>Insert()</c> will be called.
		/// </remarks>
		bool IsIdentifierAssignedByInsert { get; }

		/// <summary>
		/// Are instances of this class versioned by a timestamp or version number column?
		/// </summary>
		new bool IsVersioned { get; }

		/// <summary>
		/// Get the type of versioning (optional operation)
		/// </summary>
		IVersionType VersionType { get; }

		/// <summary>
		/// Which property holds the version number? (optional operation)
		/// </summary>
		int VersionProperty { get; }

		/// <summary> 
		/// If the entity defines a natural id (<see cref="HasNaturalIdentifier"/>), which
		/// properties make up the natural id. 
		/// </summary>
		/// <returns> 
		/// The indices of the properties making of the natural id; or
		/// null, if no natural id is defined.
		/// </returns>
		int[] NaturalIdentifierProperties { get;}

		/// <summary>
		/// Return the <c>IIdentifierGenerator</c> for the class
		/// </summary>
		IIdentifierGenerator IdentifierGenerator { get; }

		/// <summary>
		/// Get the Hibernate types of the class properties
		/// </summary>
		IType[] PropertyTypes { get; }

		/// <summary>
		/// Get the names of the class properties - doesn't have to be the names of the actual
		/// .NET properties (used for XML generation only)
		/// </summary>
		string[] PropertyNames { get; }

		/// <summary>
		/// Gets if the Property is insertable.
		/// </summary>
		/// <value><see langword="true" /> if the Property's value can be inserted.</value>
		/// <remarks>
		/// This is for formula columns and if the user sets the insert attribute on the &lt;property&gt; element.
		/// </remarks>
		bool[] PropertyInsertability { get; }

		/// <summary> Which of the properties of this class are database generated values on insert?</summary>
		ValueInclusion[] PropertyInsertGenerationInclusions { get;}

		/// <summary> Which of the properties of this class are database generated values on update?</summary>
		ValueInclusion[] PropertyUpdateGenerationInclusions { get;}

		/// <summary>
		/// Properties that may be dirty (and thus should be dirty-checked). These
		/// include all updatable properties and some associations.
		/// </summary>
		bool[] PropertyCheckability { get; }

		/// <summary>
		/// Get the nullability of the properties of this class
		/// </summary>
		bool[] PropertyNullability { get; }

		/// <summary>
		/// Get the "versionability" of the properties of this class (is the property optimistic-locked)
		/// </summary>
		/// <value><see langword="true" /> if the property is optimistic-locked; otherwise, <see langword="false" />.</value>
		bool[] PropertyVersionability { get; }

		bool[] PropertyLaziness { get;}

		/// <summary>
		/// Get the cascade styles of the properties (optional operation)
		/// </summary>
		CascadeStyle[] PropertyCascadeStyles { get; }

		/// <summary>
		/// Get the identifier type
		/// </summary>
		IType IdentifierType { get; }

		/// <summary>
		/// Get the name of the indentifier property (or return null) - need not return the
		/// name of an actual .NET property
		/// </summary>
		string IdentifierPropertyName { get; }

		/// <summary>
		/// Should we always invalidate the cache instead of recaching updated state
		/// </summary>
		bool IsCacheInvalidationRequired { get; }

		/// <summary>
		/// Should lazy properties of this entity be cached?
		/// </summary>
		bool IsLazyPropertiesCacheable { get;}

		/// <summary>
		/// Get the cache (optional operation)
		/// </summary>
		ICacheConcurrencyStrategy Cache { get; }

		/// <summary> Get the cache structure</summary>
		ICacheEntryStructure CacheEntryStructure { get;}

		/// <summary>
		/// Get the user-visible metadata for the class (optional operation)
		/// </summary>
		IClassMetadata ClassMetadata { get; }

		/// <summary>
		/// Is batch loading enabled?
		/// </summary>
		bool IsBatchLoadable { get; }

		/// <summary> Is select snapshot before update enabled?</summary>
		bool IsSelectBeforeUpdateRequired { get; }

		/// <summary>
		/// Does this entity contain a version property that is defined
		/// to be database generated?
		/// </summary>
		bool IsVersionPropertyGenerated { get; }

		/// <summary>
		/// Finish the initialization of this object, once all <c>ClassPersisters</c> have been
		/// instantiated. Called only once, before any other method.
		/// </summary>
		void PostInstantiate();

		#region stuff that is persister-centric and/or EntityInfo-centric

		/// <summary> 
		/// Determine whether the given name represents a subclass entity
		/// (or this entity itself) of the entity mapped by this persister. 
		/// </summary>
		/// <param name="entityName">The entity name to be checked. </param>
		/// <returns> 
		/// True if the given entity name represents either the entity mapped by this persister or one of its subclass entities; 
		/// false otherwise.
		/// </returns>
		bool IsSubclassEntityName(string entityName);

		/// <summary>
		/// Does this class support dynamic proxies?
		/// </summary>
		bool HasProxy { get; }

		/// <summary>
		/// Do instances of this class contain collections?
		/// </summary>
		bool HasCollections { get; }

		/// <summary> 
		/// Determine whether any properties of this entity are considered mutable. 
		/// </summary>
		/// <returns> 
		/// True if any properties of the entity are mutable; false otherwise (meaning none are).
		/// </returns>
		bool HasMutableProperties { get;}

		/// <summary> 
		/// Determine whether this entity contains references to persistent collections
		/// which are fetchable by subselect? 
		/// </summary>
		/// <returns> 
		/// True if the entity contains collections fetchable by subselect; false otherwise.
		/// </returns>
		bool HasSubselectLoadableCollections { get;}

		/// <summary>
		/// Does this class declare any cascading save/update/deletes?
		/// </summary>
		bool HasCascades { get; }

		/// <summary>
		/// Get the type of a particular property
		/// </summary>
		/// <param name="propertyName"></param>
		/// <returns></returns>
		IType GetPropertyType(string propertyName);

		/// <summary> Locate the property-indices of all properties considered to be dirty. </summary>
		/// <param name="currentState">The current state of the entity (the state to be checked). </param>
		/// <param name="previousState">The previous state of the entity (the state to be checked against). </param>
		/// <param name="entity">The entity for which we are checking state dirtiness. </param>
		/// <param name="session">The session in which the check is ccurring. </param>
		/// <returns> <see langword="null" /> or the indices of the dirty properties </returns>
		int[] FindDirty(object[] currentState, object[] previousState, object entity, ISessionImplementor session);

		/// <summary> Locate the property-indices of all properties considered to be dirty. </summary>
		/// <param name="old">The old state of the entity.</param>
		/// <param name="current">The current state of the entity. </param>
		/// <param name="entity">The entity for which we are checking state modification. </param>
		/// <param name="session">The session in which the check is ccurring. </param>
		/// <returns>return <see langword="null" /> or the indicies of the modified properties</returns>
		int[] FindModified(object[] old, object[] current, object entity, ISessionImplementor session);

		/// <summary>
		/// Does the class have a property holding the identifier value?
		/// </summary>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -