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


C# IEntityPersister.GetPropertyValues方法代码示例

本文整理汇总了C#中IEntityPersister.GetPropertyValues方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityPersister.GetPropertyValues方法的具体用法?C# IEntityPersister.GetPropertyValues怎么用?C# IEntityPersister.GetPropertyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntityPersister的用法示例。


在下文中一共展示了IEntityPersister.GetPropertyValues方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: Disassemble

		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <param name="persister"></param>
		/// <param name="session"></param>
		/// <returns></returns>
		private static object[] Disassemble(object obj, IEntityPersister persister, ISessionImplementor session)
		{
			object[] values = persister.GetPropertyValues(obj);
			IType[] propertyTypes = persister.PropertyTypes;
			for (int i = 0; i < values.Length; i++)
			{
				values[i] = propertyTypes[i].Disassemble(values[i], session);
			}
			return values;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:17,代码来源:CacheEntry.cs

示例3: Process

		internal override void Process(object obj, IEntityPersister persister)
		{
			EntityMode entityMode = Session.EntityMode;
			object[] values = persister.GetPropertyValues(obj, entityMode);
			IType[] types = persister.PropertyTypes;
			ProcessEntityPropertyValues(values, types);
			if (SubstitutionRequired)
			{
				persister.SetPropertyValues(obj, values, entityMode);
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:11,代码来源:WrapVisitor.cs

示例4: GetPropertyValues

		private object[] GetPropertyValues(IEntityPersister persister, ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			System.Type type = _entity.GetType();
			if(type == persister.GetMappedClass(GetEntityMode(criteria, criteriaQuery))) //not using anon object
			{
				return persister.GetPropertyValues(_entity, GetEntityMode(criteria, criteriaQuery));
			}
			ArrayList list = new ArrayList();
			for(int i = 0; i < persister.PropertyNames.Length; i++)
			{
				PropertyInfo pInfo = type.GetProperty(persister.PropertyNames[i]);
				if(pInfo != null)
				{
					list.Add(pInfo.GetValue(_entity, null));
				}
				else
				{
					list.Add(null); //to maintain same order as PropertyNames list
					_excludedProperties.Add(persister.PropertyNames[i]); //exclude the properties that aren't in the anon object (duplicates ok)
				}
			}
			return list.ToArray();
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:23,代码来源:Example.cs

示例5: CopyValues

		protected virtual void CopyValues(IEntityPersister persister, object entity, object target,
			ISessionImplementor source, IDictionary copyCache, ForeignKeyDirection foreignKeyDirection)
		{
			object[] copiedValues;

			if (foreignKeyDirection == ForeignKeyDirection.ForeignKeyToParent)
			{
				// this is the second pass through on a merge op, so here we limit the
				// replacement to associations types (value types were already replaced
				// during the first pass)
				copiedValues =
					TypeFactory.ReplaceAssociations(persister.GetPropertyValues(entity, source.EntityMode),
					                                persister.GetPropertyValues(target, source.EntityMode), persister.PropertyTypes,
					                                source, target, copyCache, foreignKeyDirection);
			}
			else
			{
				copiedValues =
					TypeFactory.Replace(persister.GetPropertyValues(entity, source.EntityMode),
					                    persister.GetPropertyValues(target, source.EntityMode), persister.PropertyTypes, source, target,
					                    copyCache, foreignKeyDirection);
			}

			persister.SetPropertyValues(target, copiedValues, source.EntityMode);
		}
开发者ID:ray2006,项目名称:WCell,代码行数:25,代码来源:DefaultMergeEventListener.cs

示例6: DeleteEntity

        /// <summary> 
        /// Perform the entity deletion.  Well, as with most operations, does not
        /// really perform it; just schedules an action/execution with the
        /// <see cref="ActionQueue"/> for execution during flush. 
        /// </summary>
        /// <param name="session">The originating session </param>
        /// <param name="entity">The entity to delete </param>
        /// <param name="entityEntry">The entity's entry in the <see cref="ISession"/> </param>
        /// <param name="isCascadeDeleteEnabled">Is delete cascading enabled? </param>
        /// <param name="persister">The entity persister. </param>
        /// <param name="transientEntities">A cache of already deleted entities. </param>
        protected virtual void DeleteEntity(IEventSource session, object entity, EntityEntry entityEntry, bool isCascadeDeleteEnabled, IEntityPersister persister, ISet transientEntities)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("deleting " + MessageHelper.InfoString(persister, entityEntry.Id, session.Factory));
            }

            IPersistenceContext persistenceContext = session.PersistenceContext;

            IType[] propTypes = persister.PropertyTypes;
            object version = entityEntry.Version;

            object[] currentState;
            if (entityEntry.LoadedState == null)
            {
                //ie. the entity came in from update()
                currentState = persister.GetPropertyValues(entity, session.EntityMode);
            }
            else
            {
                currentState = entityEntry.LoadedState;
            }

            object[] deletedState = CreateDeletedState(persister, currentState, session);
            entityEntry.DeletedState = deletedState;

            session.Interceptor.OnDelete(entity, entityEntry.Id, deletedState, persister.PropertyNames, propTypes);

            // before any callbacks, etc, so subdeletions see that this deletion happened first
            persistenceContext.SetEntryStatus(entityEntry, Status.Deleted);
            EntityKey key = new EntityKey(entityEntry.Id, persister, session.EntityMode);

            CascadeBeforeDelete(session, persister, entity, entityEntry, transientEntities);

            new ForeignKeys.Nullifier(entity, true, false, session).NullifyTransientReferences(entityEntry.DeletedState, propTypes);
            new Nullability(session).CheckNullability(entityEntry.DeletedState, persister, true);
            persistenceContext.NullifiableEntityKeys.Add(key);

            // Ensures that containing deletions happen before sub-deletions
            session.ActionQueue.AddAction(new EntityDeleteAction(entityEntry.Id, deletedState, version, entity, persister, isCascadeDeleteEnabled, session));

            CascadeAfterDelete(session, persister, entity, transientEntities);

            // the entry will be removed after the flush, and will no longer
            // override the stale snapshot
            // This is now handled by removeEntity() in EntityDeleteAction
            //persistenceContext.removeDatabaseSnapshot(key);
        }
开发者ID:zibler,项目名称:zibler,代码行数:59,代码来源:DefaultDeleteEventListener.cs

示例7: Process

		public override void Process(object obj, IEntityPersister persister)
		{
			object[] values = persister.GetPropertyValues(obj);
			IType[] types = persister.PropertyTypes;
			ProcessValues(values, types);
			if (IsSubstitutionRequired)
			{
				persister.SetPropertyValues(obj, values);
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:10,代码来源:WrapVisitor.cs

示例8: Process

		/// <summary>
		/// Walk the tree starting from the given entity.
		/// </summary>
		/// <param name="obj"></param>
		/// <param name="persister"></param>
		internal virtual void Process(object obj, IEntityPersister persister)
		{
			ProcessEntityPropertyValues(persister.GetPropertyValues(obj, Session.EntityMode), persister.PropertyTypes);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:9,代码来源:AbstractVisitor.cs

示例9: Process

		/// <summary>
		/// Walk the tree starting from the given entity.
		/// </summary>
		/// <param name="obj"></param>
		/// <param name="persister"></param>
		public virtual void Process(object obj, IEntityPersister persister)
		{
			ProcessValues(
				persister.GetPropertyValues(obj),
				persister.PropertyTypes);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:11,代码来源:AbstractVisitor.cs


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