當前位置: 首頁>>代碼示例>>C#>>正文


C# QueryTranslator.GetPropertyMapping方法代碼示例

本文整理匯總了C#中NHibernate.Hql.Classic.QueryTranslator.GetPropertyMapping方法的典型用法代碼示例。如果您正苦於以下問題:C# QueryTranslator.GetPropertyMapping方法的具體用法?C# QueryTranslator.GetPropertyMapping怎麽用?C# QueryTranslator.GetPropertyMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Hql.Classic.QueryTranslator的用法示例。


在下文中一共展示了QueryTranslator.GetPropertyMapping方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Token

		public void Token(string token, QueryTranslator q)
		{
			if (token != null)
			{
				path.Append(token);
			}

			string alias = q.GetPathAlias(path.ToString());
			if (alias != null)
			{
				Reset(q); //reset the dotcount (but not the path)
				currentName = alias; //after reset!
				currentPropertyMapping = q.GetPropertyMapping(currentName);
				if (!ignoreInitialJoin)
				{
					JoinSequence ojf = q.GetPathJoin(path.ToString());
					try
					{
						joinSequence.AddCondition(ojf.ToJoinFragment(q.EnabledFilters, true).ToWhereFragmentString); //after reset!
					}
					catch (MappingException me)
					{
						throw new QueryException(me);
					}
					// we don't need to worry about any condition in the ON clause
					// here (toFromFragmentString), since anything in the ON condition 
					// is already applied to the whole query
				}
			}
			else if (".".Equals(token))
			{
				dotcount++;
			}
			else
			{
				if (dotcount == 0)
				{
					if (!continuation)
					{
						if (!q.IsName(token))
						{
							throw new QueryException("undefined alias or unknown mapping: " + token);
						}
						currentName = token;
						currentPropertyMapping = q.GetPropertyMapping(currentName);
					}
				}
				else if (dotcount == 1)
				{
					if (currentName != null)
					{
						currentProperty = token;
					}
					else if (collectionName != null)
					{
						//IQueryableCollection p = q.GetCollectionPersister( collectionRole );
						//DoCollectionProperty( token, p, collectionName );
						continuation = false;
					}
					else
					{
						throw new QueryException("unexpected");
					}
				}
				else
				{
					// dotcount>=2

					// Do the corresponding RHS
					IType propertyType = PropertyType;

					if (propertyType == null)
					{
						throw new QueryException("unresolved property: " + currentProperty);
					}

					if (propertyType.IsComponentType)
					{
						DereferenceComponent(token);
					}
					else if (propertyType.IsEntityType)
					{
						DereferenceEntity(token, (EntityType) propertyType, q);
					}
					else if (propertyType.IsCollectionType)
					{
						DereferenceCollection(token, ((CollectionType) propertyType).Role, q);
					}
					else if (token != null)
					{
						throw new QueryException("dereferenced: " + currentProperty);
					}
				}
			}
		}
開發者ID:khaliyo,項目名稱:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代碼行數:95,代碼來源:PathExpressionParser.cs


注:本文中的NHibernate.Hql.Classic.QueryTranslator.GetPropertyMapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。