当前位置: 首页>>代码示例>>C#>>正文


C# IEntityPersister类代码示例

本文整理汇总了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;
 }
开发者ID:umutyenilmis,项目名称:NhibernateExample,代码行数:7,代码来源:SetCreationDateListener.cs

示例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;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:16,代码来源:ScheduledInsertion.cs

示例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;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:43,代码来源:AbstractReassociateEventListener.cs

示例5: Validate

		protected virtual void Validate(object entity, IEntityPersister persister, IEventSource source)
		{
			if (persister.ImplementsValidatable(source.EntityMode))
			{
				((IValidatable)entity).Validate();
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:AbstractSaveEventListener.cs

示例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;
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:DelWorkUnit.cs

示例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;
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:7,代码来源:EntityDeleteAction.cs

示例9: Update

        public void Update(IAuditable auditable, object[] oldState, object[] state, IEntityPersister persister)
        {
            if (auditable == null)
                return;

            this.SetChange(auditable, state);
        }
开发者ID:dwdkls,项目名称:pizzamvc,代码行数:7,代码来源:PersistenceModelAuditor.cs

示例10: PreDeleteEvent

		public PreDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister)
		{
			this.entity = entity;
			this.id = id;
			this.deletedState = deletedState;
			this.persister = persister;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:PreDeleteEvent.cs

示例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;
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:12,代码来源:AbstractPreDatabaseOperationEvent.cs

示例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]];
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:25,代码来源:SelectGenerator.cs

示例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();
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:33,代码来源:MessageHelper.cs

示例14: BatchingEntityLoader

		public BatchingEntityLoader(IEntityPersister persister, int[] batchSizes, Loader[] loaders)
		{
			this.batchSizes = batchSizes;
			this.loaders = loaders;
			this.persister = persister;
			idType = persister.IdentifierType;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:BatchingEntityLoader.cs

示例15: Update

     public void Update(IStampedEntity entity, object[] oldState, 
 object[] state, IEntityPersister persister)
     {
         if (entity == null)
           return;
         SetChange(entity, state, persister);
     }
开发者ID:akhuang,项目名称:NHibernate,代码行数:7,代码来源:Stamper.cs


注:本文中的IEntityPersister类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。