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

C# ISessionImplementor类代码示例

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

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



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

示例1: Load

		public object Load(object id, object optionalObject, ISessionImplementor session)
		{
			object[] batch = session.PersistenceContext.BatchFetchQueue.GetEntityBatch(persister, id, batchSizes[0]);

			for (int i = 0; i < batchSizes.Length - 1; i++)
			{
				int smallBatchSize = batchSizes[i];
				if (batch[smallBatchSize - 1] != null)
				{
					object[] smallBatch = new object[smallBatchSize];
					Array.Copy(batch, 0, smallBatch, 0, smallBatchSize);

					IList results = loaders[i].LoadEntityBatch(
						session,
						smallBatch,
						idType,
						optionalObject,
						persister.EntityName,
						id,
						persister);

					return GetObjectFromList(results, id, session); //EARLY EXIT
				}
			}

			return ((IUniqueEntityLoader) loaders[batchSizes.Length - 1]).Load(id, optionalObject, session);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:27,代码来源:BatchingEntityLoader.cs


示例2: Load

		public object Load( ISessionImplementor session, object id, object optionalObject, object optionalId )
		{
			IList list = LoadEntity( session, id, uniqueKeyType, optionalObject, optionalId );
			if( list.Count == 1 )
			{
				return list[ 0 ];
			}
			else if( list.Count == 0 )
			{
				return null;
			}
			else
			{
				if ( CollectionOwner > -1 )
				{
					return list[ 0 ];
				}
				else
				{
					throw new HibernateException(
						"More than one row with the given identifier was found: " +
						id +
						", for class: " +
						Persister.ClassName );
				}
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:27,代码来源:EntityLoader.cs


示例3: Get

		public IList Get(QueryKey key, ICacheAssembler[] returnTypes, Iesi.Collections.Generic.ISet<string> spaces, ISessionImplementor session)
		{
			if (log.IsDebugEnabled)
			{
				log.Debug("checking cached query results in region: " + regionName);
			}
			IList cacheable = (IList) queryCache.Get(key);
			if (cacheable == null)
			{
				log.Debug("query results were not found in cache");
				return null;
			}
			IList result = new ArrayList(cacheable.Count - 1);
			long timestamp = (long) cacheable[0];
			log.Debug("Checking query spaces for up-to-dateness [" + spaces + "]");
			if (! IsUpToDate(spaces, timestamp))
			{
				log.Debug("cached query results were not up to date");
				return null;
			}
			log.Debug("returning cached query results");
			for (int i = 1; i < cacheable.Count; i++)
			{
				if (returnTypes.Length == 1)
				{
					result.Add(returnTypes[0].Assemble(cacheable[i], session, null));
				}
				else
				{
					result.Add(TypeFactory.Assemble((object[]) cacheable[i], returnTypes, session, null));
				}
			}
			return result;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:34,代码来源:StandardQueryCache.cs


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


示例5: Put

		public bool Put(QueryKey key, ICacheAssembler[] returnTypes, IList result, bool isNaturalKeyLookup, ISessionImplementor session)
		{
			if (isNaturalKeyLookup && result.Count == 0)
				return false;

			long ts = session.Timestamp;

			if (Log.IsDebugEnabled)
				Log.DebugFormat("caching query results in region: '{0}'; {1}", _regionName, key);

			IList cacheable = new List<object>(result.Count + 1) {ts};
			for (int i = 0; i < result.Count; i++)
			{
				if (returnTypes.Length == 1 && !key.HasResultTransformer)
				{
					cacheable.Add(returnTypes[0].Disassemble(result[i], session, null));
				}
				else
				{
					cacheable.Add(TypeHelper.Disassemble((object[]) result[i], returnTypes, null, session, null));
				}
			}

			_queryCache.Put(key, cacheable);

			return true;
		}
开发者ID:jaundice,项目名称:nhibernate-core,代码行数:27,代码来源:StandardQueryCache.cs


示例6: Disassemble

		/// <summary>
		/// Disassembles the object into a cacheable representation.
		/// </summary>
		/// <param name="value">The value to disassemble.</param>
		/// <param name="session">The <see cref="ISessionImplementor"/> is not used by this method.</param>
		/// <param name="owner">optional parent entity object (needed for collections) </param>
		/// <returns>The disassembled, deep cloned state of the object</returns>
		/// <remarks>
		/// This method calls DeepCopy if the value is not null.
		/// </remarks>
		public virtual object Disassemble(object value, ISessionImplementor session, object owner)
		{
			if (value == null) 
				return null;

			return DeepCopy(value, session.EntityMode, session.Factory);
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:17,代码来源:AbstractType.cs


示例7: Load

        protected virtual object Load(ISessionImplementor session, object id, object optionalObject, object optionalId)
        {
            IList list = LoadEntity(session, id, uniqueKeyType, optionalObject, entityName, optionalId, persister);

            if (list.Count == 1)
            {
                return list[0];
            }
            else if (list.Count == 0)
            {
                return null;
            }
            else
            {
                if (CollectionOwners != null)
                {
                    return list[0];
                }
                else
                {
                    throw new HibernateException(
                        string.Format("More than one row with the given identifier was found: {0}, for class: {1}", id,
                                      persister.EntityName));
                }
            }
        }
开发者ID:zibler,项目名称:zibler,代码行数:26,代码来源:AbstractEntityLoader.cs


示例8: EnlistInDistributedTransactionIfNeeded

		public void EnlistInDistributedTransactionIfNeeded(ISessionImplementor session)
		{
			if (session.TransactionContext != null)
				return;
			if (System.Transactions.Transaction.Current == null)
				return;
			var transactionContext = new DistributedTransactionContext(session, System.Transactions.Transaction.Current);
			session.TransactionContext = transactionContext;
			logger.DebugFormat("enlisted into DTC transaction: {0}", transactionContext.AmbientTransation.IsolationLevel);
			session.AfterTransactionBegin(null);
			transactionContext.AmbientTransation.TransactionCompleted += delegate(object sender, TransactionEventArgs e)
			{
				bool wasSuccessful = false;
				try
				{
					wasSuccessful = e.Transaction.TransactionInformation.Status
					                == TransactionStatus.Committed;
				}
				catch (ObjectDisposedException ode)
				{
					logger.Warn("Completed transaction was disposed, assuming transaction rollback", ode);
				}
				session.AfterTransactionCompletion(wasSuccessful, null);
				if (transactionContext.ShouldCloseSessionOnDistributedTransactionCompleted)
				{
					session.CloseSessionFromDistributedTransaction();
				}
				session.TransactionContext = null;
			};
			transactionContext.AmbientTransation.EnlistVolatile(transactionContext, EnlistmentOptions.EnlistDuringPrepareRequired);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:31,代码来源:AdoNetWithDistrubtedTransactionFactory.cs


示例9: ProcessReachableCollection

        /// <summary> 
        /// Initialize the role of the collection. 
        /// </summary>
        /// <param name="collection">The collection to be updated by reachibility. </param>
        /// <param name="type">The type of the collection. </param>
        /// <param name="entity">The owner of the collection. </param>
        /// <param name="session">The session.</param>
        public static void ProcessReachableCollection(IPersistentCollection collection, CollectionType type, object entity, ISessionImplementor session)
        {
            collection.Owner = entity;
            CollectionEntry ce = session.PersistenceContext.GetCollectionEntry(collection);

            if (ce == null)
            {
                // refer to comment in StatefulPersistenceContext.addCollection()
                throw new HibernateException(string.Format("Found two representations of same collection: {0}", type.Role));
            }

            // The CollectionEntry.isReached() stuff is just to detect any silly users
            // who set up circular or shared references between/to collections.
            if (ce.IsReached)
            {
                // We've been here before
                throw new HibernateException(string.Format("Found shared references to a collection: {0}", type.Role));
            }
            ce.IsReached = true;

            ISessionFactoryImplementor factory = session.Factory;
            ICollectionPersister persister = factory.GetCollectionPersister(type.Role);
            ce.CurrentPersister = persister;
            ce.CurrentKey = type.GetKeyOfOwner(entity, session); //TODO: better to pass the id in as an argument?

            if (log.IsDebugEnabled)
            {
                log.Debug("Collection found: " +
                    MessageHelper.InfoString(persister, ce.CurrentKey, factory) + ", was: " +
                    MessageHelper.InfoString(ce.LoadedPersister, ce.LoadedKey, factory) +
                    (collection.WasInitialized ? " (initialized)" : " (uninitialized)"));
            }

            PrepareCollectionForUpdate(collection, ce);
        }
开发者ID:zibler,项目名称:zibler,代码行数:42,代码来源:Collections.cs


示例10: GetResultColumnOrRow

		protected override object GetResultColumnOrRow(object[] row, IResultTransformer resultTransformer, IDataReader rs,
		                                               ISessionImplementor session)
		{
			object[] result;
			string[] aliases;

			if (translator.HasProjection)
			{
				IType[] types = translator.ProjectedTypes;
				result = new object[types.Length];
				string[] columnAliases = translator.ProjectedColumnAliases;

				for (int i = 0; i < result.Length; i++)
				{
					result[i] = types[i].NullSafeGet(rs, columnAliases[i], session, null);
				}
				aliases = translator.ProjectedAliases;
			}
			else
			{
				result = row;
				aliases = userAliases;
			}
			return translator.RootCriteria.ResultTransformer.TransformTuple(result, aliases);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:25,代码来源:CriteriaLoader.cs


示例11: 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="IClassPersister"/> that is responsible for the persisting the object.</param>
		protected ScheduledEntityAction( ISessionImplementor session, object id, object instance, IClassPersister persister )
		{
			this.session = session;
			this.id = id;
			this.persister = persister;
			this.instance = instance;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:ScheduledEntityAction.cs


示例12: FlushMightBeNeeded

		private bool FlushMightBeNeeded(ISessionImplementor source)
		{
			return
				!(source.FlushMode < FlushMode.Auto)
				&& source.DontFlushFromFind == 0
				&& ((source.PersistenceContext.EntityEntries.Count > 0) || (source.PersistenceContext.CollectionEntries.Count > 0));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:DefaultAutoFlushEventListener.cs


示例13: BindNamedParameters

		/// <summary> 
		/// Bind named parameters to the <tt>PreparedStatement</tt>. This has an
		/// empty implementation on this superclass and should be implemented by
		/// subclasses (queries) which allow named parameters.
		/// </summary>
		private void BindNamedParameters(IDbCommand ps, IDictionary namedParams, int start, ISessionImplementor session)
		{
			if (namedParams != null)
			{
				// assumes that types are all of span 1
				int result = 0;
				foreach (DictionaryEntry param in namedParams)
				{
					string name = (string)param.Key;
					TypedValue typedval = (TypedValue)param.Value;

					int[] locs = GetNamedParameterLocs(name);
					for (int i = 0; i < locs.Length; i++)
					{
						if (log.IsDebugEnabled)
						{
							log.Debug(string.Format("BindNamedParameters() {0} -> {1} [{2}]", typedval.Value, name, (locs[i] + start)));
						}
						typedval.Type.NullSafeSet(ps, typedval.Value, locs[i] + start, session);
					}
					result += locs.Length;
				}
				return;
			}
			else
			{
				return;
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:34,代码来源:NativeSQLQueryPlan.cs


示例14: ScheduledCollectionUpdate

		/// <summary>
		/// Initializes a new instance of <see cref="ScheduledCollectionUpdate"/>.
		/// </summary>
		/// <param name="collection">The <see cref="IPersistentCollection"/> to update.</param>
		/// <param name="persister">The <see cref="ICollectionPersister"/> that is responsible for the persisting the Collection.</param>
		/// <param name="id">The identifier of the Collection owner.</param>
		/// <param name="emptySnapshot">Indicates if the Collection was empty when it was loaded.</param>
		/// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param>
		public ScheduledCollectionUpdate(IPersistentCollection collection, ICollectionPersister persister, object id,
		                                 bool emptySnapshot, ISessionImplementor session)
			: base(persister, id, session)
		{
			_collection = collection;
			_emptySnapshot = emptySnapshot;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:15,代码来源:ScheduledCollectionUpdate.cs


示例15: AbstractAuditWorkUnit

        protected AbstractAuditWorkUnit(ISessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg,
									    Object id) {
		    this.sessionImplementor = sessionImplementor;
            this.verCfg = verCfg;
            this.EntityId = id;
            this.EntityName = entityName;
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:AbstractAuditWorkUnit.cs


示例16: ReplaceElements

		public override object ReplaceElements(object original, object target, object owner, IDictionary copyCache, ISessionImplementor session)
		{
			ICollectionPersister cp = session.Factory.GetCollectionPersister(Role);

			IDictionary result = (IDictionary)target;
			result.Clear();

			IEnumerable iter = (IDictionary)original;
			foreach (DictionaryEntry me in iter)
			{
				object key = cp.IndexType.Replace(me.Key, null, session, owner, copyCache);
				object value = cp.ElementType.Replace(me.Value, null, session, owner, copyCache);
				result[key] = value;
			}

			var originalPc = original as IPersistentCollection;
			var resultPc = result as IPersistentCollection;
			if (originalPc != null && resultPc != null)
			{
				if (!originalPc.IsDirty)
					resultPc.ClearDirty();
			}

			return result;
		}
开发者ID:nikson,项目名称:nhibernate-core,代码行数:25,代码来源:MapType.cs


示例17: Load

		public object Load(object id, object optionalObject, ISessionImplementor session)
		{
			if (log.IsDebugEnabled)
			{
				log.Debug(string.Format("loading entity: {0} using named query: {1}", persister.EntityName, queryName));
			}

			AbstractQueryImpl query = (AbstractQueryImpl) session.GetNamedQuery(queryName);
			if (query.HasNamedParameters)
			{
				query.SetParameter(query.NamedParameters[0], id, persister.IdentifierType);
			}
			else
			{
				query.SetParameter(0, id, persister.IdentifierType);
			}
			query.SetOptionalId(id);
			query.SetOptionalEntityName(persister.EntityName);
			query.SetOptionalObject(optionalObject);
			query.SetFlushMode(FlushMode.Never);
			query.List();

			// now look up the object we are really interested in!
			// (this lets us correctly handle proxies and multi-row
			// or multi-column queries)
			return session.PersistenceContext.GetEntity(session.GenerateEntityKey(id, persister));
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:27,代码来源:NamedQueryLoader.cs


示例18: GetProxy

    public INHibernateProxy GetProxy(object id, ISessionImplementor session)
    {
        INHibernateProxy proxy;
        try
        {
            object generatedProxy;
            LazyInitializer initializer = new LazyInitializer(_entityName, _persistentClass, id, _getIdentifierMethod, _setIdentifierMethod, _componentIdType, session);
            IInterceptor[] interceptors = new IInterceptor[] { initializer };

            object[] args;
            if (_isClassProxy)
            {
                args = new object[] { interceptors };
            }
            else
            {
                args = new object[] { interceptors, new object() };
            }
            generatedProxy = Activator.CreateInstance(_proxyType, args);

            initializer._constructed = true;
            proxy = (INHibernateProxy)generatedProxy;
        }
        catch (Exception e)
        {
            string message = "Creating a proxy instance failed";
            _log.Error(message, e);
            throw new HibernateException(message, e);
        }

        return proxy;
    }
开发者ID:spib,项目名称:nhcontrib,代码行数:32,代码来源:CastleStaticProxyFactory.cs


示例19: Nullifier

			public Nullifier(object self, bool isDelete, bool isEarlyInsert, ISessionImplementor session)
			{
				this.isDelete = isDelete;
				this.isEarlyInsert = isEarlyInsert;
				this.session = session;
				this.self = self;
			}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:ForeignKeys.cs


示例20: BulkOperationCleanupAction

        /// <summary>
        /// Create an action that will evict collection and entity regions based on queryspaces (table names).  
        /// </summary>
        public BulkOperationCleanupAction(ISessionImplementor session, ISet<string> querySpaces)
        {
            //from H3.2 TODO: cache the autodetected information and pass it in instead.
            this.session = session;

            ISet<string> tmpSpaces = new HashedSet<string>(querySpaces);
            ISessionFactoryImplementor factory = session.Factory;
            IDictionary acmd = factory.GetAllClassMetadata();
            foreach (DictionaryEntry entry in acmd)
            {
                string entityName = ((System.Type) entry.Key).FullName;
                IEntityPersister persister = factory.GetEntityPersister(entityName);
                string[] entitySpaces = persister.QuerySpaces;

                if (AffectedEntity(querySpaces, entitySpaces))
                {
                    if (persister.HasCache)
                    {
                        affectedEntityNames.Add(persister.EntityName);
                    }
                    ISet roles = session.Factory.GetCollectionRolesByEntityParticipant(persister.EntityName);
                    if (roles != null)
                    {
                        affectedCollectionRoles.AddAll(roles);
                    }
                    for (int y = 0; y < entitySpaces.Length; y++)
                    {
                        tmpSpaces.Add(entitySpaces[y]);
                    }
                }
            }
            spaces = new List<string>(tmpSpaces);
        }
开发者ID:zibler,项目名称:zibler,代码行数:36,代码来源:BulkOperationCleanupAction.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ISessionManager类代码示例发布时间:2022-05-24
下一篇:
C# ISessionFactoryImplementor类代码示例发布时间: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