コード例 #1
0
		protected override void PostInstantiate()
		{
			ILoadable[] persisters = EntityPersisters;
			string[] suffixes = Suffixes;
			descriptors = new IEntityAliases[persisters.Length];
			for (int i = 0; i < descriptors.Length; i++)
			{
				descriptors[i] = new DefaultEntityAliases(persisters[i], suffixes[i]);
			}

			ICollectionPersister[] collectionPersisters = CollectionPersisters;
			if (collectionPersisters != null)
			{
				String[] collectionSuffixes = CollectionSuffixes;
				collectionDescriptors = new ICollectionAliases[collectionPersisters.Length];
				for (int i = 0; i < collectionPersisters.Length; i++)
				{
					collectionDescriptors[i] = new GeneratedCollectionAliases(
						collectionPersisters[i],
						collectionSuffixes[i]
						);
				}
			}
			else
			{
				collectionDescriptors = null;
			}
		}
コード例 #2
0
		protected override void PostInstantiate()
		{
			ILoadable[] persisters = EntityPersisters;
			string[] suffixes = Suffixes;
			descriptors = new IEntityAliases[persisters.Length];
			for (int i = 0; i < descriptors.Length; i++)
			{
				descriptors[i] = new DefaultEntityAliases(persisters[i], suffixes[i]);
			}

			ICollectionPersister[] collectionPersisters = CollectionPersisters;
			int bagCount = 0;
			if (collectionPersisters != null)
			{
				string[] collectionSuffixes = CollectionSuffixes;
				collectionDescriptors = new ICollectionAliases[collectionPersisters.Length];
				for (int i = 0; i < collectionPersisters.Length; i++)
				{
					if (IsBag(collectionPersisters[i]))
					{
						bagCount++;
					}
					collectionDescriptors[i] = new GeneratedCollectionAliases(collectionPersisters[i], collectionSuffixes[i]);
				}
			}
			else
			{
				collectionDescriptors = null;
			}
			// H3.2 : 14.3. Associations and joins
			// Join fetching multiple collection roles also sometimes gives unexpected results for bag mappings, 
			// so be careful about how you formulate your queries in this case
			if (bagCount > 1)
			{
				throw new QueryException("Cannot simultaneously fetch multiple bags.");
			}
		}