本文整理汇总了C#中HashedSet.AddAll方法的典型用法代码示例。如果您正苦于以下问题:C# HashedSet.AddAll方法的具体用法?C# HashedSet.AddAll怎么用?C# HashedSet.AddAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashedSet
的用法示例。
在下文中一共展示了HashedSet.AddAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildSearcher
public static IndexSearcher BuildSearcher(ISearchFactoryImplementor searchFactory,
out ISet<System.Type> classesAndSubclasses,
params System.Type[] classes)
{
IDictionary<System.Type, DocumentBuilder> builders = searchFactory.DocumentBuilders;
ISet<IDirectoryProvider> directories = new HashedSet<IDirectoryProvider>();
if (classes == null || classes.Length == 0)
{
// no class means all classes
foreach (DocumentBuilder builder in builders.Values)
{
foreach (IDirectoryProvider provider in builder.DirectoryProvidersSelectionStrategy.GetDirectoryProvidersForAllShards())
{
directories.Add(provider);
}
}
// Give them back an empty set
classesAndSubclasses = null;
}
else
{
ISet<System.Type> involvedClasses = new HashedSet<System.Type>();
involvedClasses.AddAll(classes);
foreach (System.Type clazz in classes)
{
DocumentBuilder builder;
builders.TryGetValue(clazz, out builder);
if (builder != null)
{
involvedClasses.AddAll(builder.MappedSubclasses);
}
}
foreach (System.Type clazz in involvedClasses)
{
DocumentBuilder builder;
builders.TryGetValue(clazz, out builder);
// TODO should we rather choose a polymorphic path and allow non mapped entities
if (builder == null)
{
throw new HibernateException("Not a mapped entity: " + clazz);
}
foreach (IDirectoryProvider provider in builder.DirectoryProvidersSelectionStrategy.GetDirectoryProvidersForAllShards())
{
directories.Add(provider);
}
}
classesAndSubclasses = involvedClasses;
}
IDirectoryProvider[] directoryProviders = new List<IDirectoryProvider>(directories).ToArray();
return new IndexSearcher(searchFactory.ReaderProvider.OpenReader(directoryProviders));
}
示例2: NativeSQLQuerySpecification
public NativeSQLQuerySpecification(
string queryString,
ISQLQueryReturn[] sqlQueryReturns,
ICollection querySpaces)
{
this.queryString = queryString;
this.sqlQueryReturns = sqlQueryReturns;
if (querySpaces == null)
{
this.querySpaces = new HashedSet();
}
else
{
ISet tmp = new HashedSet();
tmp.AddAll(querySpaces);
// Can't use ImmutableSet here because it doesn't implement GetHashCode properly.
this.querySpaces = tmp;
}
// pre-determine and cache the hashcode
int hashCode = queryString.GetHashCode();
unchecked
{
hashCode = 29 * hashCode + this.querySpaces.GetHashCode();
if (this.sqlQueryReturns != null)
{
hashCode = 29 * hashCode + sqlQueryReturns.Length;
}
}
this.hashCode = hashCode;
}
示例3: EntityPropertyAndCollectionTypes
private IList<Type> EntityPropertyAndCollectionTypes()
{
ISet<Type> types = new HashedSet<Type>();
foreach(var type in Assembly.GetTypes())
{
if (!DomainFilter(type)) continue;
foreach(var property in type.GetProperties())
{
var referred = new List<Type>(
property.PropertyType.IsGenericType
? property.PropertyType.GetGenericArguments()
: new[] {property.PropertyType});
referred.Remove(type); // remove self-reference
types.AddAll(referred);
}
}
return new List<Type>(types);
}
示例4: GetQuerySpaces
public ISet GetQuerySpaces()
{
ISet result = new HashedSet();
foreach (System.Type entityName in criteriaEntityNames.Values)
{
result.AddAll(Factory.GetEntityPersister(entityName).QuerySpaces);
}
foreach (ICollectionPersister collectionPersister in criteriaCollectionPersisters)
{
result.Add(collectionPersister.CollectionSpace);
}
return result;
}
示例5: GetPriors
public GetPriorsResponse GetPriors(GetPriorsRequest request)
{
Platform.CheckForNullReference(request, "request");
if (request.OrderRef == null && request.ReportRef == null)
throw new ArgumentException("Either OrderRef or ReportRef must be non-null");
var priorReports = new HashedSet<Prior>();
var broker = this.PersistenceContext.GetBroker<IPriorReportBroker>();
// if an order was supplied, find relevant priors for the order
if (request.OrderRef != null)
{
var order = this.PersistenceContext.Load<Order>(request.OrderRef, EntityLoadFlags.Proxy);
priorReports.AddAll(broker.GetPriors(order, request.RelevantOnly));
}
// if a report was supplied, find relevent priors for the report
else if (request.ReportRef != null)
{
var report = this.PersistenceContext.Load<Report>(request.ReportRef, EntityLoadFlags.Proxy);
priorReports.AddAll(broker.GetPriors(report, request.RelevantOnly));
}
// assemble results
var procedureTypeAssembler = new ProcedureTypeAssembler();
var diagnosticServiceAssembler = new DiagnosticServiceAssembler();
// Note: we use the ProcedureCheckin.CheckOutTime as the PerformedDate
// because it is the closest to the end of modality procedure step completion time.
// However, if we change the definition of CheckOutTime in the future, this won't be accurate
var priorSummaries = CollectionUtils.Map(priorReports,
(Prior prior) => new PriorProcedureSummary(
prior.Order.GetRef(),
prior.Procedure.GetRef(),
prior.Report.GetRef(),
prior.Order.AccessionNumber,
diagnosticServiceAssembler.CreateSummary(prior.Order.DiagnosticService),
procedureTypeAssembler.CreateSummary(prior.ProcedureType),
prior.Procedure.Portable,
EnumUtils.GetEnumValueInfo(prior.Procedure.Laterality, PersistenceContext),
EnumUtils.GetEnumValueInfo(prior.Report.Status, PersistenceContext),
prior.Procedure.ProcedureCheckIn.CheckOutTime));
return new GetPriorsResponse(priorSummaries);
}
示例6: Find
/// <summary>
///
/// </summary>
/// <param name="criteria"></param>
/// <returns></returns>
public IList Find( CriteriaImpl criteria )
{
// The body of this method is modified from H2.1 version, because the Java version
// used factory.GetImplementors which returns a list of implementor class names
// obtained from IClassPersister.ClassName property.
//
// In Java, calling ReflectHelper.ClassForName( IClassPersister.ClassName )
// works, but in .NET it does not, because the class name does not include the assembly
// name. .NET tries to load the class from NHibernate assembly and fails.
//
// The solution was to add SessionFactoryImpl.GetImplementorClasses method
// which returns an array of System.Types instead of just class names.
System.Type[ ] implementors = factory.GetImplementorClasses( criteria.CriteriaClass );
int size = implementors.Length;
CriteriaLoader[ ] loaders = new CriteriaLoader[size];
ISet spaces = new HashedSet();
for( int i = 0; i < size; i++ )
{
System.Type newCriteriaClazz = implementors[ i ];
loaders[ i ] = new CriteriaLoader(
GetOuterJoinLoadable( newCriteriaClazz ),
factory,
new CriteriaImpl( newCriteriaClazz, criteria )
);
spaces.AddAll( loaders[ i ].QuerySpaces );
}
AutoFlushIfRequired( spaces );
IList results = new ArrayList();
dontFlushFromFind++;
try
{
for( int i = 0; i < size; i++ )
{
IList currentResults;
try
{
currentResults = loaders[ i ].List( this );
}
catch( HibernateException )
{
// Do not call Convert on HibernateExceptions
throw;
}
catch( Exception sqle )
{
throw Convert( sqle, "Unable to perform find" );
}
foreach( object result in results )
{
currentResults.Add( result );
}
results = currentResults;
}
}
finally
{
dontFlushFromFind--;
}
return results;
}
示例7: GetAllSoggettiFornitori
public BindingList<RichiedentePraticaDTO> GetAllSoggettiFornitori(CondominioDTO condominio)
{
IList<RichiedentePraticaDTO> fornitoriPreferiti = (from fornitore in _fornitoreService.GetPreferitiByCondominio(condominio.ID)
select new RichiedentePraticaDTO()
{
Id = fornitore.ID,
DisplayNominativo = fornitore.PersonaRiferimento.DisplayName,
IdCondominio = condominio.ID,
IdPersona = fornitore.PersonaRiferimento.ID,
Tipo = "Fornitore"
}).ToList();
IList<RichiedentePraticaDTO> soggetti = (from soggetto in _soggettoService.GetByCondominio(condominio)
select new RichiedentePraticaDTO()
{
Id = soggetto.ID,
DisplayNominativo = soggetto.DisplayNominativo,
DescrizioneUnitaImmobiliare = soggetto.DescrizioneUnitaImmobiliare,
IdCondominio = condominio.ID,
IdPersona = soggetto.IdPersona,
IdUnitaImmobiliare = soggetto.IdUnitaImmobiliare,
OrdineUnitaImmobiliare = soggetto.OrdineUnitaImmobiliare,
Tipo = soggetto.Tipo.ToString()
}).ToList();
ISet<RichiedentePraticaDTO> richiedenti = new HashedSet<RichiedentePraticaDTO>(soggetti);
richiedenti.AddAll(fornitoriPreferiti);
return new BindingList<RichiedentePraticaDTO>(richiedenti.ToList());
}
示例8: GetQuerySpaces
public Iesi.Collections.Generic.ISet<string> GetQuerySpaces()
{
Iesi.Collections.Generic.ISet<string> result = new HashedSet<string>();
foreach (ICriteriaInfoProvider info in criteriaInfoMap.Values)
{
result.AddAll(info.Spaces);
}
foreach (ICollectionPersister collectionPersister in criteriaCollectionPersisters)
{
result.AddAll(collectionPersister.CollectionSpaces);
}
return result;
}
示例9: AddAll
public static bool AddAll(ICollection source, HashedSet dest)
{
return dest.AddAll(source);
}
示例10: CreateCriteriaLoaders
private void CreateCriteriaLoaders()
{
//a criteria can use more than a single query (polymorphic queries), need to have a
//way to correlate a loader to a result index
int criteriaIndex = 0;
foreach (CriteriaImpl criteria in criteriaQueries)
{
string[] implementors = factory.GetImplementors(criteria.EntityOrClassName);
int size = implementors.Length;
CriteriaLoader[] tmpLoaders = new CriteriaLoader[size];
Iesi.Collections.Generic.ISet<string> spaces = new HashedSet<string>();
for (int i = 0; i < size; i++)
{
CriteriaLoader loader = new CriteriaLoader(
session.GetOuterJoinLoadable(implementors[i]),
factory,
criteria,
implementors[i],
session.EnabledFilters
);
tmpLoaders[i] = loader;
loaderToResultIndex[loader] = criteriaIndex;
spaces.AddAll(tmpLoaders[i].QuerySpaces);
}
loaders.AddRange(tmpLoaders);
criteriaIndex += 1;
}
}
示例11: Execute
public List<InterpretationStep> Execute(ReportingProcedureStep step, Staff executingStaff, Staff assignStaff, IWorkflow workflow)
{
step.Discontinue();
// cancel the report part if exists
if (step.ReportPart != null)
step.ReportPart.Cancel();
var interpretationSteps = new List<InterpretationStep>();
if (!IsAddendumStep(step))
{
var procedures = new HashedSet<Procedure> { step.Procedure };
// if there are linked procedures, schedule a new interpretation for each procedure being reported
if (step.ReportPart != null)
{
procedures.AddAll(step.ReportPart.Report.Procedures);
}
// schedule new interpretations
foreach (var procedure in procedures)
{
var interpretationStep = new InterpretationStep(procedure);
// Bug: #5128 - if the procedure is not document, do not schedule the replacement interpretation step,
// since interpretation steps aren't scheduled until documentation is complete.
if (procedure.IsDocumented)
interpretationStep.Schedule(procedure.PerformedTime);
if (assignStaff != null)
interpretationStep.Assign(assignStaff);
interpretationSteps.Add(interpretationStep);
workflow.AddEntity(interpretationStep);
}
}
return interpretationSteps;
}
示例12: ListUsingQueryCache
private IList ListUsingQueryCache()
{
IQueryCache queryCache = session.Factory.GetQueryCache(cacheRegion);
ISet filterKeys = FilterKey.CreateFilterKeys(session.EnabledFilters, session.EntityMode);
ISet<string> querySpaces = new HashedSet<string>();
ArrayList resultTypesList = new ArrayList();
for (int i = 0; i < Translators.Count; i++)
{
QueryTranslator queryTranslator = (QueryTranslator)Translators[i];
querySpaces.AddAll(queryTranslator.QuerySpaces);
resultTypesList.Add(queryTranslator.ActualReturnTypes);
}
int[] firstRows = new int[Parameters.Count];
int[] maxRows = new int[Parameters.Count];
for (int i = 0; i < Parameters.Count; i++)
{
RowSelection rowSelection = ((QueryParameters)Parameters[i]).RowSelection;
firstRows[i] = rowSelection.FirstRow;
maxRows[i] = rowSelection.MaxRows;
}
MultipleQueriesCacheAssembler assembler = new MultipleQueriesCacheAssembler(resultTypesList);
QueryKey key = new QueryKey(session.Factory, SqlString, combinedParameters, filterKeys)
.SetFirstRows(firstRows)
.SetMaxRows(maxRows);
IList result =
assembler.GetResultFromQueryCache(session,
combinedParameters,
querySpaces,
queryCache,
key);
if (result == null)
{
log.Debug("Cache miss for multi query");
ArrayList list = DoList();
queryCache.Put(key, new ICacheAssembler[] { assembler }, new object[] { list }, session);
result = list;
}
return GetResultList(result);
}
示例13: getUnitaByConto
private IList<UnitaImmobiliare> getUnitaByConto(ContiModelloRegistrazioneContabile dettaglioModello)
{
Iesi.Collections.Generic.ISet<UnitaImmobiliare> listaUnita = new HashedSet<UnitaImmobiliare>();
if (dettaglioModello.Unita.Count > 0)
{
foreach (var dettaglioRiparto in dettaglioModello.Unita)
{
if (dettaglioRiparto.LottoRiferimento != null)
listaUnita.AddAll(dettaglioRiparto.LottoRiferimento.GetUnitaImmobiliari());
else if (dettaglioRiparto.PalazzinaRiferimento != null)
listaUnita.AddAll(dettaglioRiparto.PalazzinaRiferimento.GetUnitaImmobiliari());
else if (dettaglioRiparto.GruppoStabileRiferimento != null)
listaUnita.AddAll(dettaglioRiparto.GruppoStabileRiferimento.UnitaImmobiliari);
else if (dettaglioRiparto.UnitaRiferimento != null)
listaUnita.Add(dettaglioRiparto.UnitaRiferimento);
else
listaUnita.AddAll(dettaglioModello.Modello.CondominioRiferimento.GetUnitaImmobiliari());
}
}
else
listaUnita.AddAll(dettaglioModello.Modello.CondominioRiferimento.GetUnitaImmobiliari());
return listaUnita.ToList();
}
示例14: GetUnitaContoModello
public IList<UnitaImmobiliare> GetUnitaContoModello(MovimentoContabile movimento, int index)
{
try
{
Iesi.Collections.Generic.ISet<UnitaImmobiliare> listaUnita = new HashedSet<UnitaImmobiliare>();
if (movimento.Spesa != null)
{
if (movimento.Spesa.Utenza.ModelloRegistrazione.Conti.Count > index)
{
var dettaglioModello = movimento.Spesa.Utenza.ModelloRegistrazione.Conti.ToList()[index];
listaUnita.AddAll(getUnitaByConto(dettaglioModello));
}
else
listaUnita.AddAll(movimento.Testata.EsercizioRiferimento.CondominioRiferimento.GetUnitaImmobiliari());
}
return listaUnita.ToList();
}
catch (Exception ex)
{
_log.Error("Errore nella lettura delle unità - " + Library.Utility.GetMethodDescription() + " - movimento:" + movimento.ID + " - index:" + index, ex);
throw;
}
}
示例15: GetUnitaModello
public IList<UnitaImmobiliare> GetUnitaModello(ModelloRegistrazioneContabile modello)
{
Iesi.Collections.Generic.ISet<UnitaImmobiliare> listaUnita = new HashedSet<UnitaImmobiliare>();
foreach (var dettaglioModello in modello.Conti)
listaUnita.AddAll(getUnitaByConto(dettaglioModello));
return listaUnita.ToList();
}