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


C# ISessionImplementor.BestGuessEntityName方法代码示例

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


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

示例1: IsModified

		public override bool IsModified(object old, object current, bool[] checkable, ISessionImplementor session)
		{
			if (current == null)
				return old != null;
			if (old == null)
				return current != null;
			ObjectTypeCacheEntry holder = (ObjectTypeCacheEntry)old;
			bool[] idcheckable = new bool[checkable.Length - 1];
			Array.Copy(checkable, 1, idcheckable, 0, idcheckable.Length);
			return (checkable[0] && !holder.entityName.Equals(session.BestGuessEntityName(current))) || 
				identifierType.IsModified(holder.id, Id(current, session), idcheckable, session);
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:12,代码来源:AnyType.cs

示例2: addCollectionChangeWorkUnitToAuditProcess

        private void addCollectionChangeWorkUnitToAuditProcess(ISessionImplementor session, AuditProcess auditProcess, object value)
        {
            // relDesc.getToEntityName() doesn't always return the entity name of the value - in case
            // of subclasses, this will be root class, no the actual class. So it can't be used here.
            string toEntityName;
            object id;

            var newValueAsProxy = value as INHibernateProxy;
            if (newValueAsProxy != null)
            {
                toEntityName = session.BestGuessEntityName(value);
                id = newValueAsProxy.HibernateLazyInitializer.Identifier;
                // We've got to initialize the object from the proxy to later read its state.
                value = Toolz.GetTargetFromProxy((ISession) session, newValueAsProxy);
            }
            else
            {
                toEntityName = session.GuessEntityName(value);

                var idMapper = VerCfg.EntCfg[toEntityName].IdMapper;
                id = idMapper.MapToIdFromEntity(value);
            }

            auditProcess.AddWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, VerCfg, id, value));
        }
开发者ID:umittal,项目名称:MunimJi,代码行数:25,代码来源:AuditEventListener.cs

示例3: GetPropertyValues

		public object[] GetPropertyValues(object component, ISessionImplementor session)
		{
			return new object[] { session.BestGuessEntityName(component), Id(component, session) };
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:4,代码来源:AnyType.cs

示例4: Id

		private static object Id(object component, ISessionImplementor session)
		{
			try
			{
				return ForeignKeys.GetEntityIdentifierIfNotUnsaved(session.BestGuessEntityName(component), component, session);
			}
			catch (TransientObjectException)
			{
				return null;
			}
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:11,代码来源:AnyType.cs

示例5: GetPropertyValue

		public object GetPropertyValue(Object component, int i, ISessionImplementor session)
		{
			return i == 0 ? session.BestGuessEntityName(component) : Id(component, session);
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:4,代码来源:AnyType.cs

示例6: Replace

		public override object Replace(object original, object current, ISessionImplementor session, object owner,
									   IDictionary copiedAlready)
		{
			if (original == null)
			{
				return null;
			}
			else
			{
				string entityName = session.BestGuessEntityName(original);
				object id = ForeignKeys.GetEntityIdentifierIfNotUnsaved(entityName, original, session);
				return session.InternalLoad(entityName, id, false, false);
			}
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:14,代码来源:AnyType.cs

示例7: Disassemble

		public override object Disassemble(object value, ISessionImplementor session, object owner)
		{
			return value == null ? null : 
				new ObjectTypeCacheEntry(session.BestGuessEntityName(value), 
				ForeignKeys.GetEntityIdentifierIfNotUnsaved(session.BestGuessEntityName(value), value, session));
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:6,代码来源:AnyType.cs

示例8: NullSafeSet

		public override void NullSafeSet(IDbCommand st, object value, int index, bool[] settable, ISessionImplementor session)
		{
			object id;
			string entityName;
			if (value == null)
			{
				id = null;
				entityName = null;
			}
			else
			{
				entityName = session.BestGuessEntityName(value);
				id = ForeignKeys.GetEntityIdentifierIfNotUnsaved(entityName, value, session);
			}

			// metaType is assumed to be single-column type
			if (settable == null || settable[0])
			{
				metaType.NullSafeSet(st, entityName, index, session);
			}
			if (settable == null)
			{
				identifierType.NullSafeSet(st, id, index + 1, session);
			}
			else
			{
				bool[] idsettable = new bool[settable.Length - 1];
				Array.Copy(settable, 1, idsettable, 0, idsettable.Length);
				identifierType.NullSafeSet(st, id, index + 1, idsettable, session);
			}
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:31,代码来源:AnyType.cs

示例9: GenerateBidirectionalCollectionChangeWorkUnits

        private void GenerateBidirectionalCollectionChangeWorkUnits(AuditSync verSync, IEntityPersister entityPersister,
                                                                    String entityName, Object[] newState, Object[] oldState,
                                                                    ISessionImplementor session) {
            // Checking if this is enabled in configuration ...
            if (!verCfg.GlobalCfg.isGenerateRevisionsForCollections()) {
                return;
            }

            // Checks every property of the entity, if it is an "owned" to-one relation to another entity.
            // If the value of that property changed, and the relation is bi-directional, a new revision
            // for the related entity is generated.
            String[] propertyNames = entityPersister.PropertyNames;

            for (int i=0; i<propertyNames.GetLength(0); i++) {
                String propertyName = propertyNames[i];
                RelationDescription relDesc = verCfg.EntCfg.GetRelationDescription(entityName, propertyName);
                if (relDesc != null && relDesc.Bidirectional && relDesc.RelationType == RelationType.TO_ONE &&
                        relDesc.Insertable) {
                    // Checking for changes
                    Object oldValue = oldState == null ? null : oldState[i];
                    Object newValue = newState == null ? null : newState[i];

                    if (!Toolz.EntitiesEqual(session, oldValue, newValue)) {
                        // We have to generate changes both in the old collection (size decreses) and new collection
                        // (size increases).

                        //<TODO Simon: doua if-uri cu cod duplicat, refact.
                        if (newValue != null) {
                            // relDesc.getToEntityName() doesn't always return the entity name of the value - in case
                            // of subclasses, this will be root class, no the actual class. So it can't be used here.
                            String toEntityName;
                            
                            // Java: Serializable id
						    object id;

                            if (newValue is INHibernateProxy) {
                    	        INHibernateProxy hibernateProxy = (INHibernateProxy) newValue;
                    	        toEntityName = session.BestGuessEntityName(newValue);
                    	        id = hibernateProxy.HibernateLazyInitializer.Identifier;
							    // We've got to initialize the object from the proxy to later read its state.   
							    newValue = NHibernate.Envers.Tools.Toolz.GetTargetFromProxy(session.Factory, hibernateProxy);
                    	    } else {
                    		    toEntityName =  session.GuessEntityName(newValue);

							    IIdMapper idMapper = verCfg.EntCfg[toEntityName].GetIdMapper();
                         	    id = idMapper.MapToIdFromEntity(newValue);
                    	    }

                            verSync.AddWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, newValue));
                        }

                        if (oldValue != null) {
                    	    String toEntityName;
						    object id;

                    	    if(oldValue is INHibernateProxy) {
                    	        INHibernateProxy hibernateProxy = (INHibernateProxy) oldValue;
                    	        toEntityName = session.BestGuessEntityName(oldValue);
                    	        id = hibernateProxy.HibernateLazyInitializer.Identifier;
							    // We've got to initialize the object as we'll read it's state anyway.
							    oldValue = Toolz.GetTargetFromProxy(session.Factory, hibernateProxy);
                    	    } else {
                    		    toEntityName =  session.GuessEntityName(oldValue);

							    IIdMapper idMapper = verCfg.EntCfg[toEntityName].GetIdMapper();
							    id = idMapper.MapToIdFromEntity(oldValue);
                    	    }
    						
                            verSync.AddWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, oldValue));
                        }
                    }
                }
            }
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:74,代码来源:AuditEventListener.cs


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