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


C# IAssociationType.GetAssociatedJoinable方法代码示例

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


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

示例1: Join

			public Join(ISessionFactoryImplementor factory, IAssociationType associationType, string alias, JoinType joinType,
			            string[] lhsColumns)
			{
				this.associationType = associationType;
				this.joinable = associationType.GetAssociatedJoinable(factory);
				this.alias = alias;
				this.joinType = joinType;
				this.lhsColumns = lhsColumns;
			}
开发者ID:pallmall,项目名称:WCell,代码行数:9,代码来源:JoinSequence.cs

示例2: GetRHSColumnNames

		/// <summary>
		/// Get the columns of the associated table which are to 
		/// be used in the join
		/// </summary>
		public static string[] GetRHSColumnNames(IAssociationType type, ISessionFactoryImplementor factory)
		{
			string uniqueKeyPropertyName = type.RHSUniqueKeyPropertyName;
			IJoinable joinable = type.GetAssociatedJoinable(factory);
			if (uniqueKeyPropertyName == null)
			{
				return joinable.JoinColumnNames;
			}
			else
			{
				return ((IOuterJoinLoadable)joinable).GetPropertyColumnNames(uniqueKeyPropertyName);
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:17,代码来源:JoinHelper.cs

示例3: OuterJoinableAssociation

		public OuterJoinableAssociation(IAssociationType joinableType, String lhsAlias, String[] lhsColumns, String rhsAlias,
		                                JoinType joinType, ISessionFactoryImplementor factory,
		                                IDictionary<string, IFilter> enabledFilters)
		{
			this.joinableType = joinableType;
			this.lhsAlias = lhsAlias;
			this.lhsColumns = lhsColumns;
			this.rhsAlias = rhsAlias;
			this.joinType = joinType;
			joinable = joinableType.GetAssociatedJoinable(factory);
			rhsColumns = JoinHelper.GetRHSColumnNames(joinableType, factory);
			on = joinableType.GetOnCondition(rhsAlias, factory, enabledFilters);
			this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
		}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:14,代码来源:OuterJoinableAssociation.cs

示例4: OuterJoinableAssociation

		public OuterJoinableAssociation(IAssociationType joinableType, String lhsAlias, String[] lhsColumns, String rhsAlias,
		                                JoinType joinType, SqlString withClause, ISessionFactoryImplementor factory,
		                                IDictionary<string, IFilter> enabledFilters)
		{
			this.joinableType = joinableType;
			this.lhsAlias = lhsAlias;
			this.lhsColumns = lhsColumns;
			this.rhsAlias = rhsAlias;
			this.joinType = joinType;
			joinable = joinableType.GetAssociatedJoinable(factory);
			rhsColumns = JoinHelper.GetRHSColumnNames(joinableType, factory);
			on = new SqlString(joinableType.GetOnCondition(rhsAlias, factory, enabledFilters));
			if (StringHelper.IsNotEmpty(withClause))
				on = on.Append(" and ( ").Append(withClause).Append(" )");
			this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:16,代码来源:OuterJoinableAssociation.cs

示例5: IsDuplicateAssociation

		/// <summary>
		/// Used to detect circularities in the joined graph, note that
		/// this method is side-effecty
		/// </summary>
		protected virtual bool IsDuplicateAssociation(string lhsTable, string[] lhsColumnNames, IAssociationType type)
		{
			string foreignKeyTable;
			string[] foreignKeyColumns;

			if (type.ForeignKeyDirection.Equals(ForeignKeyDirection.ForeignKeyFromParent))
			{
				foreignKeyTable = lhsTable;
				foreignKeyColumns = lhsColumnNames;
			}
			else
			{
				foreignKeyTable = type.GetAssociatedJoinable(Factory).TableName;
				foreignKeyColumns = JoinHelper.GetRHSColumnNames(type, Factory);
			}

			return IsDuplicateAssociation(foreignKeyTable, foreignKeyColumns);
		}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:22,代码来源:JoinWalker.cs

示例6: AddAssociationToJoinTree

		/// <summary>
		/// Add on association (one-to-one, many-to-one, or a collection) to a list
		/// of associations to be fetched by outerjoin
		/// </summary>
		private void AddAssociationToJoinTree(IAssociationType type, string[] aliasedLhsColumns, string alias,
			string path, int currentDepth, JoinType joinType)
		{
			IJoinable joinable = type.GetAssociatedJoinable(Factory);

			string subalias = GenerateTableAlias(associations.Count + 1, path, joinable);

			OuterJoinableAssociation assoc =
				new OuterJoinableAssociation(type, alias, aliasedLhsColumns, subalias, joinType, GetWithClause(path), Factory, enabledFilters);
			assoc.ValidateJoin(path);
			AddAssociation(subalias, assoc);

			int nextDepth = currentDepth + 1;

			if (!joinable.IsCollection)
			{
				IOuterJoinLoadable pjl = joinable as IOuterJoinLoadable;
				if (pjl != null)
					WalkEntityTree(pjl, subalias, path, nextDepth);
			}
			else
			{
				IQueryableCollection qc = joinable as IQueryableCollection;
				if (qc != null)
					WalkCollectionTree(qc, subalias, path, nextDepth);
			}
		}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:31,代码来源:JoinWalker.cs

示例7: MakeAssociationProperty

        /// <summary>
        /// Make association property metadata for the entity.
        /// Also populates the _fkMap which is used for related-entity fixup in NHContext.FixupRelationships
        /// </summary>
        /// <param name="propType"></param>
        /// <param name="propName"></param>
        /// <param name="pClass"></param>
        /// <param name="relatedDataPropertyMap"></param>
        /// <returns></returns>
        private Dictionary<string, object> MakeAssociationProperty(Type containingType, IAssociationType propType, string propName, string columnNames, PersistentClass pClass, Dictionary<string, Dictionary<string, object>> relatedDataPropertyMap, bool isKey)
        {
            var nmap = new Dictionary<string, object>();
            nmap.Add("nameOnServer", propName);

            var relatedEntityType = GetEntityType(propType.ReturnedClass, propType.IsCollectionType);
            nmap.Add("entityTypeName", relatedEntityType.Name + ":#" + relatedEntityType.Namespace);
            nmap.Add("isScalar", !propType.IsCollectionType);

            // the associationName must be the same at both ends of the association.
            nmap.Add("associationName", GetAssociationName(containingType.Name, relatedEntityType.Name, (propType is OneToOneType)));

            // look up the related foreign key name using the column name
            Dictionary<string, object> relatedDataProperty = null;
            string fkName = null;
            if (relatedDataPropertyMap.TryGetValue(columnNames, out relatedDataProperty))
            {
                fkName = (string)relatedDataProperty["nameOnServer"];
                if (propType.ForeignKeyDirection == ForeignKeyDirection.ForeignKeyFromParent)
                {
                    nmap.Add("foreignKeyNamesOnServer", new string[] { fkName });
                }
                else
                {
                    // inverse foreign key
                    // many-to-many relationships do not have a direct connection on the client or in metadata
                    var joinable = propType.GetAssociatedJoinable((ISessionFactoryImplementor)this._sessionFactory) as AbstractCollectionPersister;
                    if (joinable == null || !joinable.IsManyToMany)
                        nmap.Add("invForeignKeyNamesOnServer", new string[] { fkName });
                }
            }

            // For many-to-one and one-to-one associations, save the relationship in _fkMap for re-establishing relationships during save
            if (!propType.IsCollectionType)
            {
                var entityRelationship = pClass.EntityName + '.' + propName;
                if (relatedDataProperty != null)
                {
                    _fkMap.Add(entityRelationship, fkName);
                    if (isKey)
                    {
                        if (!relatedDataProperty.ContainsKey("isPartOfKey"))
                        {
                            relatedDataProperty.Add("isPartOfKey", true);
                        }
                    }
                }
                else
                {
                    nmap.Add("foreignKeyNamesOnServer", columnNames);
                    nmap.Add("ERROR", "Could not find matching fk for property " + entityRelationship);
                    _fkMap.Add(entityRelationship, columnNames);
                    throw new ArgumentException("Could not find matching fk for property " + entityRelationship);
                }
            }
            return nmap;
        }
开发者ID:Rickinio,项目名称:breeze.server.net,代码行数:66,代码来源:NHBreezeMetadata.cs

示例8: AddAssociationToJoinTree

		/// <summary>
		/// Add on association (one-to-one, many-to-one, or a collection) to a list
		/// of associations to be fetched by outerjoin
		/// </summary>
		private void AddAssociationToJoinTree(
			IAssociationType type,
			string[] aliasedLhsColumns,
			string alias,
			string path,
			int currentDepth,
			JoinType joinType)
		{
			IJoinable joinable = type.GetAssociatedJoinable(Factory);

			string subalias = GenerateTableAlias(
				associations.Count + 1, //before adding to collection!
				path,
				joinable
				);

			OuterJoinableAssociation assoc = new OuterJoinableAssociation(
				type,
				alias,
				aliasedLhsColumns,
				subalias,
				joinType,
				Factory,
				enabledFilters
				);
			assoc.ValidateJoin(path);
			associations.Add(assoc);

			int nextDepth = currentDepth + 1;

			if (!joinable.IsCollection)
			{
				if (joinable is IOuterJoinLoadable)
				{
					WalkEntityTree(
						(IOuterJoinLoadable) joinable,
						subalias,
						path,
						nextDepth
						);
				}
			}
			else
			{
				if (joinable is IQueryableCollection)
				{
					WalkCollectionTree(
						(IQueryableCollection) joinable,
						subalias,
						path,
						nextDepth
						);
				}
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:59,代码来源:JoinWalker.cs


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