• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IEntityPersister类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IEntityPersister类属于命名空间,在下文中一共展示了IEntityPersister类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: ScheduledEntityAction

		/// <summary>
		/// Initializes a new instance of <see cref="ScheduledEntityAction"/>.
		/// </summary>
		/// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param>
		/// <param name="id">The identifier of the object.</param>
		/// <param name="instance">The actual object instance.</param>
		/// <param name="persister">The <see cref="IEntityPersister"/> that is responsible for the persisting the object.</param>
		protected ScheduledEntityAction(ISessionImplementor session, object id, object instance, IEntityPersister persister)
		{
			this.session = session;
			this.id = id;
			this.persister = persister;
			this.instance = instance;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:14,代码来源:ScheduledEntityAction.cs


示例17: PerformSave

            protected override object PerformSave(object entity, object id, IEntityPersister persister, bool useIdentityColumn, object anything,
           IEventSource source, bool requiresImmediateIdAccess)
            {
                var entityValue = entity as EntityBase;
                if (entityValue != null)
                {
                    if (entityValue.CreatedBy == null || entityValue.CreatedBy.Equals(string.Empty))
                    {
                        entityValue.CreatedBy = EntityConstant.CreatedBy;
                        entityValue.CreatedOn = DateTime.Now;
                    }
                    else
                    {
                        entityValue.UpdatedBy = EntityConstant.UpdatedBy;
                        entityValue.UpdatedOn = DateTime.Now;
                    }
                }

                foreach (var property in entity.GetType().GetProperties())
                {
                    var propertyValue = property.GetValue(entity, null);
                    if (propertyValue == null)
                    {
                        continue;
                    }
                    if (propertyValue.GetType().IsSubclassOf(typeof(EntityBase)))
                    {
                        var value = propertyValue as EntityBase;
                        value.CreatedBy = EntityConstant.CreatedBy;
                        value.CreatedOn = DateTime.Now;
                    }
                }

                return base.PerformSave(entityValue, id, persister, useIdentityColumn, anything, source, requiresImmediateIdAccess);
            }
开发者ID:CuongDuongDuy,项目名称:MyUniversity,代码行数:35,代码来源:NHibernateEventListener.cs


示例18: DeleteEntity

        protected override void DeleteEntity(IEventSource session, object entity,

            EntityEntry entityEntry, bool isCascadeDeleteEnabled,

            IEntityPersister persister, ISet transientEntities)
        {
            if (entity is IPermanent)
            {

                var e = (IPermanent)entity;

                e.IsDeleted = true;

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

                CascadeAfterDelete(session, persister, entity, transientEntities);

            }

            else
            {

                base.DeleteEntity(session, entity, entityEntry, isCascadeDeleteEnabled,

                                  persister, transientEntities);

            }
        }
开发者ID:akhuang,项目名称:NHibernateTest,代码行数:28,代码来源:MyDeleteEventListener.cs


示例19: SetState

 private void SetState(IEntityPersister persister,
 object[] state, string propertyName, object value)
 {
     var index = GetIndex(persister, propertyName);
     if (index == -1)
         return;
     state[index] = value;
 }
开发者ID:kriebb,项目名称:NH-2873,代码行数:8,代码来源:PreUpdateEventListenerImpl.cs


示例20: PostDeleteEvent

		public PostDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister, IEventSource source)
			: base(source)
		{
			this.entity = entity;
			this.id = id;
			this.persister = persister;
			this.deletedState = deletedState;
		}
开发者ID:ray2006,项目名称:WCell,代码行数:8,代码来源:PostDeleteEvent.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IEntityRepository类代码示例发布时间:2022-05-24
下一篇:
C# IEntityMapping类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap