本文整理汇总了C#中NHibernate.Mapping.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# List.AddRange方法的具体用法?C# List.AddRange怎么用?C# List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Mapping.List
的用法示例。
在下文中一共展示了List.AddRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlTriggerBody
public override string SqlTriggerBody(
Dialect dialect, IMapping p,
string defaultCatalog, string defaultSchema)
{
var auditTableName = dialect.QuoteForTableName(_auditTableName);
var eDialect = (IExtendedDialect)dialect;
string triggerSource = _action == TriggerActions.DELETE ?
eDialect.GetTriggerOldDataAlias() :
eDialect.GetTriggerNewDataAlias();
var columns = new List<string>(_dataColumnNames);
columns.AddRange(from ac in _auditColumns
select ac.Name);
var values = new List<string>();
values.AddRange(
from columnName in _dataColumnNames
select eDialect.QualifyColumn(
triggerSource, columnName));
values.AddRange(
from auditColumn in _auditColumns
select auditColumn.ValueFunction.Invoke(_action));
return eDialect.GetInsertIntoString(auditTableName,
columns, triggerSource, values);
}
示例2: CheckException
private IList<PrintHu> CheckException(IList<OrderMaster> orderMasterList, BusinessException businessException)
{
List<Hu> huList = new List<Hu>();
List<OrderDetail> jitOrderDetailList = new List<OrderDetail>();
List<OrderDetail> nonJITOrderDetailList = new List<OrderDetail>();
//foreach (var orderMaster in orderMasterList.Where(o => o.OrderStrategy != CodeMaster.FlowStrategy.JIT))
//{
// nonJITOrderDetailList.AddRange(orderMaster.OrderDetails);
//}
//foreach (var orderMaster in orderMasterList.Where(o => o.OrderStrategy == CodeMaster.FlowStrategy.JIT))
//{
// jitOrderDetailList.AddRange(orderMaster.OrderDetails);
//}
foreach (var orderMaster in orderMasterList.Where(o => o.OrderStrategy != CodeMaster.FlowStrategy.JIT && o.OrderStrategy != CodeMaster.FlowStrategy.Manual))
{
nonJITOrderDetailList.AddRange(orderMaster.OrderDetails);
}
foreach (var orderMaster in orderMasterList.Where(o => o.OrderStrategy == CodeMaster.FlowStrategy.JIT || o.OrderStrategy == CodeMaster.FlowStrategy.Manual))
{
jitOrderDetailList.AddRange(orderMaster.OrderDetails);
}
if (jitOrderDetailList.Count > 0)
{
huList.AddRange(this.sqLocationDetailMgr.MatchNewHuForRepack(jitOrderDetailList, true, businessException));
}
if (nonJITOrderDetailList.Count > 0)
{
IList<Hu> hus = this.sqLocationDetailMgr.MatchNewHuForRepack(nonJITOrderDetailList, false, businessException);
huList.AddRange(hus);
}
if (huList.Count > 0)
{
foreach (var hu in huList)
{
hu.ManufacturePartyDescription = base.genericMgr.FindById<Party>(hu.ManufactureParty).Name;
}
IList<PrintHu> printHuList = Mapper.Map<IList<Hu>, IList<PrintHu>>(huList);
return printHuList;
}
return new List<PrintHu>();
}
示例3: GetInvalidValues
private InvalidValue[] GetInvalidValues(object entity, ISet circularityState)
{
if (entity == null || circularityState.Contains(entity))
{
return EMPTY_INVALID_VALUE_ARRAY; //Avoid circularity
}
else
{
circularityState.Add(entity);
}
if (!entityType.IsInstanceOfType(entity))
{
throw new ArgumentException("not an instance of: " + entity.GetType());
}
List<InvalidValue> results = new List<InvalidValue>();
//Entity Validation
foreach (IValidator validator in entityValidators)
{
var constraintContext = new ConstraintValidatorContext(null,defaultInterpolator.GetAttributeMessage(validator));
if (!validator.IsValid(entity, constraintContext))
{
new InvalidMessageTransformer(constraintContext, results, entityType, null, entity, entity, validator, defaultInterpolator, userInterpolator).Transform();
}
}
results.AddRange(MembersValidation(entity, null));
//Child validation
for (int i = 0; i < childGetters.Count; i++)
{
MemberInfo member = childGetters[i];
if (NHibernateUtil.IsPropertyInitialized(entity, member.Name))
{
object value = TypeUtils.GetMemberValue(entity, member);
if (value != null && NHibernateUtil.IsInitialized(value))
{
MakeChildValidation(value, entity, member, circularityState, results);
}
}
}
return results.ToArray();
}
示例4: GenerateSchemaCreationScript
/// <summary>
/// Generate DDL for creating tables
/// </summary>
/// <param name="dialect"></param>
public string[] GenerateSchemaCreationScript(Dialect.Dialect dialect)
{
SecondPassCompile();
string defaultCatalog = PropertiesHelper.GetString(Environment.DefaultCatalog, properties, null);
string defaultSchema = PropertiesHelper.GetString(Environment.DefaultSchema, properties, null);
List<string> script = new List<string>();
foreach (Table table in TableMappings)
{
if (table.IsPhysicalTable)
{
script.Add(table.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema));
script.AddRange(table.SqlCommentStrings(dialect, defaultCatalog, defaultSchema));
}
}
foreach (Table table in TableMappings)
{
if (table.IsPhysicalTable)
{
if (!dialect.SupportsUniqueConstraintInCreateAlterTable)
{
foreach (UniqueKey uk in table.UniqueKeyIterator)
{
string constraintString = uk.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema);
if (constraintString != null)
script.Add(constraintString);
}
}
foreach (Index index in table.IndexIterator)
script.Add(index.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema));
if (dialect.HasAlterTable)
{
foreach (ForeignKey fk in table.ForeignKeyIterator)
{
if (fk.HasPhysicalConstraint)
script.Add(fk.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema));
}
}
}
}
IEnumerable<IPersistentIdentifierGenerator> pIDg = IterateGenerators(dialect);
foreach (IPersistentIdentifierGenerator idGen in pIDg)
script.AddRange(idGen.SqlCreateStrings(dialect));
foreach (IAuxiliaryDatabaseObject auxDbObj in auxiliaryDatabaseObjects)
{
if (auxDbObj.AppliesToDialect(dialect))
{
script.Add(auxDbObj.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema));
}
}
return script.ToArray();
}
示例5: GenerateChromatograms
private void GenerateChromatograms(MsDataFile msDataFile, List<AnalysisChromatograms> analyses)
{
int totalAnalyses = analyses.Count;
if (totalAnalyses == 0)
{
return;
}
if (!UpdateProgress(0))
{
return;
}
analyses = new List<AnalysisChromatograms>(analyses);
using (var pwizMsDataFileImpl = new MsDataFileImpl(msDataFile.Path))
{
var completeAnalyses = new List<AnalysisChromatograms>();
int totalScanCount = pwizMsDataFileImpl.SpectrumCount;
double minTime = msDataFile.GetTime(msDataFile.GetSpectrumCount() - 1);
double maxTime = msDataFile.GetTime(0);
foreach (var analysis in analyses)
{
minTime = Math.Min(minTime, analysis.FirstTime);
maxTime = Math.Max(maxTime, analysis.LastTime);
}
int firstScan = msDataFile.FindScanIndex(minTime);
for (int iScan = firstScan; analyses.Count > 0 && iScan < totalScanCount; iScan++)
{
double time = msDataFile.GetTime(iScan);
int progress = (int)(100 * (time - minTime) / (maxTime - minTime));
progress = Math.Min(progress, 100);
progress = Math.Max(progress, 0);
if (!UpdateProgress(progress))
{
return;
}
List<AnalysisChromatograms> activeAnalyses = new List<AnalysisChromatograms>();
double nextTime = Double.MaxValue;
if (msDataFile.GetMsLevel(iScan, pwizMsDataFileImpl) != 1)
{
continue;
}
foreach (var analysis in analyses)
{
nextTime = Math.Min(nextTime, analysis.FirstTime);
if (analysis.FirstTime <= time)
{
activeAnalyses.Add(analysis);
}
}
if (activeAnalyses.Count == 0)
{
int nextScan = msDataFile.FindScanIndex(nextTime);
iScan = Math.Max(iScan, nextScan - 1);
continue;
}
double[] mzArray, intensityArray;
pwizMsDataFileImpl.GetSpectrum(iScan, out mzArray, out intensityArray);
foreach (var analysis in activeAnalyses)
{
var points = new List<MsDataFileUtil.ChromatogramPoint>();
foreach (var chromatogram in analysis.Chromatograms)
{
points.Add(MsDataFileUtil.GetIntensity(chromatogram.Mz, mzArray, intensityArray));
}
analysis.AddPoints(iScan, time, points);
}
var incompleteAnalyses = new List<AnalysisChromatograms>();
foreach (var analysis in analyses)
{
if (analysis.LastTime <= time)
{
completeAnalyses.Add(analysis);
}
else
{
incompleteAnalyses.Add(analysis);
}
}
if (completeAnalyses.Count > 10)
{
SaveChromatograms(completeAnalyses, null);
completeAnalyses.Clear();
}
analyses = incompleteAnalyses;
}
completeAnalyses.AddRange(analyses);
SaveChromatograms(completeAnalyses, msDataFile);
lock(this)
{
_activePeptideFileAnalysisIds.Clear();
}
}
}