Beispiel #1
0
		/// <summary>
		/// For a composite element, add to a list of associations to be fetched by outerjoin
		/// </summary>
		private void WalkCompositeElementTree(IAbstractComponentType compositeType, string[] cols,
			IQueryableCollection persister, string alias, string path, int currentDepth)
		{
			IType[] types = compositeType.Subtypes;
			string[] propertyNames = compositeType.PropertyNames;
			int begin = 0;
			for (int i = 0; i < types.Length; i++)
			{
				int length = types[i].GetColumnSpan(factory);
				string[] lhsColumns = ArrayHelper.Slice(cols, begin, length);

				if (types[i].IsAssociationType)
				{
					IAssociationType associationType = types[i] as IAssociationType;

					// simple, because we can't have a one-to-one or collection
					// (or even a property-ref) in a composite element:
					string[] aliasedLhsColumns = StringHelper.Qualify(alias, lhsColumns);
					string subpath = SubPath(path, propertyNames[i]);
					bool[] propertyNullability = compositeType.PropertyNullability;

					JoinType joinType =
						GetJoinType(associationType, compositeType.GetFetchMode(i), subpath, persister.TableName, lhsColumns,
												propertyNullability == null || propertyNullability[i], currentDepth, compositeType.GetCascadeStyle(i));

					AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
				}
				else if (types[i].IsComponentType)
				{
					string subpath = SubPath(path, propertyNames[i]);
					WalkCompositeElementTree((IAbstractComponentType)types[i], lhsColumns, persister, alias, subpath, currentDepth);
				}
				begin += length;
			}
		}
Beispiel #2
0
        /// <summary>
        /// For a composite element, add to a list of associations to be fetched by outerjoin
        /// </summary>
        private void WalkCompositeElementTree(IAbstractComponentType compositeType, string[] cols,
                                              IQueryableCollection persister, string alias, string path, int currentDepth)
        {
            IType[]  types         = compositeType.Subtypes;
            string[] propertyNames = compositeType.PropertyNames;
            int      begin         = 0;

            for (int i = 0; i < types.Length; i++)
            {
                int      length     = types[i].GetColumnSpan(factory);
                string[] lhsColumns = ArrayHelper.Slice(cols, begin, length);

                if (types[i].IsAssociationType)
                {
                    IAssociationType associationType = types[i] as IAssociationType;

                    // simple, because we can't have a one-to-one or collection
                    // (or even a property-ref) in a composite element:
                    string[] aliasedLhsColumns   = StringHelper.Qualify(alias, lhsColumns);
                    string   subpath             = SubPath(path, propertyNames[i]);
                    bool[]   propertyNullability = compositeType.PropertyNullability;

                    var subPathAliases = GetChildAliases(alias, subpath);
                    foreach (var subPathAlias in subPathAliases)
                    {
                        var joinType =
                            GetJoinType(
                                associationType,
                                compositeType.GetFetchMode(i),
                                subpath,
                                subPathAlias,
                                persister.TableName,
                                lhsColumns,
                                propertyNullability == null || propertyNullability[i],
                                currentDepth,
                                compositeType.GetCascadeStyle(i));

                        AddAssociationToJoinTreeIfNecessary(
                            associationType,
                            aliasedLhsColumns,
                            alias,
                            subpath,
                            subPathAlias,
                            currentDepth,
                            joinType);
                    }
                }
                else if (types[i].IsComponentType)
                {
                    string subpath = SubPath(path, propertyNames[i]);
                    WalkCompositeElementTree(
                        (IAbstractComponentType)types[i],
                        lhsColumns,
                        persister,
                        alias,
                        subpath,
                        currentDepth);
                }
                begin += length;
            }
        }
Beispiel #3
0
		/// <summary>
		/// For a component, add to a list of associations to be fetched by outerjoin
		/// </summary>
		protected void WalkComponentTree(IAbstractComponentType componentType, int begin, string alias, string path,
		                                 int currentDepth, ILhsAssociationTypeSqlInfo associationTypeSQLInfo)
		{
			IType[] types = componentType.Subtypes;
			string[] propertyNames = componentType.PropertyNames;
			for (int i = 0; i < types.Length; i++)
			{
				if (types[i].IsAssociationType)
				{
					var associationType = (IAssociationType) types[i];

					string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, begin);
					string[] lhsColumns = associationTypeSQLInfo.GetColumnNames(associationType, begin);
					string lhsTable = associationTypeSQLInfo.GetTableName(associationType);

					string subpath = SubPath(path, propertyNames[i]);
					bool[] propertyNullability = componentType.PropertyNullability;

					JoinType joinType = GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns,
					                                propertyNullability == null || propertyNullability[i], currentDepth,
					                                componentType.GetCascadeStyle(i));

					AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
				}
				else if (types[i].IsComponentType)
				{
					string subpath = SubPath(path, propertyNames[i]);

					WalkComponentTree((IAbstractComponentType) types[i], begin, alias, subpath, currentDepth, associationTypeSQLInfo);
				}
				begin += types[i].GetColumnSpan(Factory);
			}
		}
Beispiel #4
0
		/// <summary>
		/// For a component, add to a list of associations to be fetched by outerjoin
		/// </summary>
		private void WalkComponentTree(IAbstractComponentType componentType, int propertyNumber, int begin,
			IOuterJoinLoadable persister, string alias, string path, int currentDepth)
		{
			IType[] types = componentType.Subtypes;
			string[] propertyNames = componentType.PropertyNames;
			for (int i = 0; i < types.Length; i++)
			{
				if (types[i].IsAssociationType)
				{
					IAssociationType associationType = (IAssociationType)types[i];
					string[] aliasedLhsColumns =
						JoinHelper.GetAliasedLHSColumnNames(associationType, alias, propertyNumber, begin, persister, Factory);

					string[] lhsColumns = JoinHelper.GetLHSColumnNames(associationType, propertyNumber, begin, persister, Factory);
					string lhsTable = JoinHelper.GetLHSTableName(associationType, propertyNumber, persister);

					string subpath = SubPath(path, propertyNames[i]);
					bool[] propertyNullability = componentType.PropertyNullability;

					JoinType joinType =
						GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns,
												propertyNullability == null || propertyNullability[i], currentDepth, componentType.GetCascadeStyle(i));

					AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
				}
				else if (types[i].IsComponentType)
				{
					string subpath = SubPath(path, propertyNames[i]);

					WalkComponentTree((IAbstractComponentType)types[i], propertyNumber, begin, persister, alias, subpath, currentDepth);
				}
				begin += types[i].GetColumnSpan(Factory);
			}
		}