Ejemplo n.º 1
0
 public CollectionFetchReturn(string alias, NonScalarReturn owner, string ownerProperty,
                              ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases,
                              LockMode lockMode) : base(owner, ownerProperty, alias, lockMode)
 {
     this.collectionAliases    = collectionAliases;
     this.elementEntityAliases = elementEntityAliases;
 }
		public CollectionFetchReturn(string alias, NonScalarReturn owner, string ownerProperty,
		                             ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases,
		                             LockMode lockMode) : base(owner, ownerProperty, alias, lockMode)
		{
			this.collectionAliases = collectionAliases;
			this.elementEntityAliases = elementEntityAliases;
		}
Ejemplo n.º 3
0
		public CollectionReturn(string alias, string ownerEntityName, string ownerProperty,
		                        ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases, LockMode lockMode)
			: base(alias, lockMode)
		{
			this.ownerEntityName = ownerEntityName;
			this.ownerProperty = ownerProperty;
			this.collectionAliases = collectionAliases;
			this.elementEntityAliases = elementEntityAliases;
		}
Ejemplo n.º 4
0
 public CollectionReturn(string alias, string ownerEntityName, string ownerProperty,
                         ICollectionAliases collectionAliases, IEntityAliases elementEntityAliases, LockMode lockMode)
     : base(alias, lockMode)
 {
     this.ownerEntityName      = ownerEntityName;
     this.ownerProperty        = ownerProperty;
     this.collectionAliases    = collectionAliases;
     this.elementEntityAliases = elementEntityAliases;
 }
Ejemplo n.º 5
0
 public RootReturn(
     String alias,
     String entityName,
     IEntityAliases entityAliases,
     LockMode lockMode)
     : base(alias, lockMode)
 {
     this.entityName = entityName;
     this.entityAliases = entityAliases;
 }
Ejemplo n.º 6
0
 public EntityFetchReturn(
     String alias,
     IEntityAliases entityAliases,
     NonScalarReturn owner,
     String ownerProperty,
     LockMode lockMode)
     : base(owner, ownerProperty, alias, lockMode)
 {
     this.entityAliases = entityAliases;
 }
Ejemplo n.º 7
0
		public NonScalarReturn(SQLQueryContext context, bool queryHasAliases, string alias, LockMode lockMode, NonScalarReturn owner)
		{
			if (context == null)
			{
				throw new ArgumentNullException("context");
			}
			if (string.IsNullOrEmpty(alias))
			{
				throw new HibernateException("alias must be specified");
			}

			this.alias = alias;
			this.lockMode = lockMode;
			this.owner = owner;

			this.collectionPersister = context.GetCollectionPersister(alias);
			if (this.collectionPersister != null)
			{
				var collectionPropertyResultMap = context.GetCollectionPropertyResultsMap(alias);
				this.collectionAliases = queryHasAliases
					? new GeneratedCollectionAliases(collectionPropertyResultMap, this.collectionPersister, context.GetCollectionSuffix(alias))
					: (ICollectionAliases)new ColumnCollectionAliases(collectionPropertyResultMap, this.collectionPersister);
			}

			if (this.collectionPersister == null || this.CollectionPersister.ElementType.IsEntityType)
			{
				this.entityPersister = context.GetEntityPersister(alias);
				if (this.entityPersister != null)
				{
					var entityPropertyResultMap = context.GetEntityPropertyResultsMap(alias);
					this.entityAliases = queryHasAliases
						? new DefaultEntityAliases(entityPropertyResultMap, this.entityPersister, context.GetEntitySuffix(alias))
						: new ColumnEntityAliases(entityPropertyResultMap, this.entityPersister);
				}
			}
		}
Ejemplo n.º 8
0
 public RootReturn(string alias, string entityName, IEntityAliases entityAliases, LockMode lockMode)
     : base(alias, lockMode)
 {
     this.entityName    = entityName;
     this.entityAliases = entityAliases;
 }
        public IList GenerateCustomReturns(bool queryHadAliases)
        {
            IList customReturns = new List <object>();
            IDictionary <string, object> customReturnsByAlias = new Dictionary <string, object>();

            for (int i = 0; i < queryReturns.Length; i++)
            {
                if (queryReturns[i] is NativeSQLQueryScalarReturn)
                {
                    NativeSQLQueryScalarReturn rtn = (NativeSQLQueryScalarReturn)queryReturns[i];
                    customReturns.Add(new ScalarReturn(rtn.Type, rtn.ColumnAlias));
                }
                else if (queryReturns[i] is NativeSQLQueryRootReturn)
                {
                    NativeSQLQueryRootReturn rtn = (NativeSQLQueryRootReturn)queryReturns[i];
                    string         alias         = rtn.Alias;
                    IEntityAliases entityAliases;
                    if (queryHadAliases || HasPropertyResultMap(alias))
                    {
                        entityAliases =
                            new DefaultEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                    }
                    else
                    {
                        entityAliases =
                            new ColumnEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                    }
                    RootReturn customReturn = new RootReturn(alias, rtn.ReturnEntityName, entityAliases, rtn.LockMode);
                    customReturns.Add(customReturn);
                    customReturnsByAlias[rtn.Alias] = customReturn;
                }
                else if (queryReturns[i] is NativeSQLQueryCollectionReturn)
                {
                    NativeSQLQueryCollectionReturn rtn = (NativeSQLQueryCollectionReturn)queryReturns[i];
                    string alias = rtn.Alias;
                    ISqlLoadableCollection persister = alias2CollectionPersister[alias];
                    bool isEntityElements            = persister.ElementType.IsEntityType;
                    ICollectionAliases collectionAliases;
                    IEntityAliases     elementEntityAliases = null;
                    if (queryHadAliases || HasPropertyResultMap(alias))
                    {
                        collectionAliases =
                            new GeneratedCollectionAliases(collectionPropertyResultMaps[alias], alias2CollectionPersister[alias],
                                                           alias2CollectionSuffix[alias]);
                        if (isEntityElements)
                        {
                            elementEntityAliases =
                                new DefaultEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                        }
                    }
                    else
                    {
                        collectionAliases =
                            new ColumnCollectionAliases(collectionPropertyResultMaps[alias], alias2CollectionPersister[alias]);
                        if (isEntityElements)
                        {
                            elementEntityAliases =
                                new ColumnEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                        }
                    }
                    CollectionReturn customReturn =
                        new CollectionReturn(alias, rtn.OwnerEntityName, rtn.OwnerProperty, collectionAliases, elementEntityAliases,
                                             rtn.LockMode);
                    customReturns.Add(customReturn);
                    customReturnsByAlias[rtn.Alias] = customReturn;
                }
                else if (queryReturns[i] is NativeSQLQueryJoinReturn)
                {
                    NativeSQLQueryJoinReturn rtn = (NativeSQLQueryJoinReturn)queryReturns[i];
                    string                 alias = rtn.Alias;
                    FetchReturn            customReturn;
                    NonScalarReturn        ownerCustomReturn = (NonScalarReturn)customReturnsByAlias[rtn.OwnerAlias];
                    ISqlLoadableCollection persister;
                    if (alias2CollectionPersister.TryGetValue(alias, out persister))
                    {
                        bool isEntityElements = persister.ElementType.IsEntityType;
                        ICollectionAliases collectionAliases;
                        IEntityAliases     elementEntityAliases = null;
                        if (queryHadAliases || HasPropertyResultMap(alias))
                        {
                            collectionAliases =
                                new GeneratedCollectionAliases(collectionPropertyResultMaps[alias], persister, alias2CollectionSuffix[alias]);
                            if (isEntityElements)
                            {
                                elementEntityAliases =
                                    new DefaultEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                            }
                        }
                        else
                        {
                            collectionAliases = new ColumnCollectionAliases(collectionPropertyResultMaps[alias], persister);
                            if (isEntityElements)
                            {
                                elementEntityAliases =
                                    new ColumnEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                            }
                        }
                        customReturn =
                            new CollectionFetchReturn(alias, ownerCustomReturn, rtn.OwnerProperty, collectionAliases, elementEntityAliases,
                                                      rtn.LockMode);
                    }
                    else
                    {
                        IEntityAliases entityAliases;
                        if (queryHadAliases || HasPropertyResultMap(alias))
                        {
                            entityAliases =
                                new DefaultEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                        }
                        else
                        {
                            entityAliases =
                                new ColumnEntityAliases(entityPropertyResultMaps[alias], alias2Persister[alias], alias2Suffix[alias]);
                        }
                        customReturn = new EntityFetchReturn(alias, entityAliases, ownerCustomReturn, rtn.OwnerProperty, rtn.LockMode);
                    }
                    customReturns.Add(customReturn);
                    customReturnsByAlias[alias] = customReturn;
                }
            }
            return(customReturns);
        }
Ejemplo n.º 10
0
 public EntityFetchReturn(string alias, IEntityAliases entityAliases, NonScalarReturn owner, string ownerProperty,
                          LockMode lockMode) : base(owner, ownerProperty, alias, lockMode)
 {
     this.entityAliases = entityAliases;
 }