本文整理汇总了C#中MessageCollection.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# MessageCollection.AddRange方法的具体用法?C# MessageCollection.AddRange怎么用?C# MessageCollection.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageCollection
的用法示例。
在下文中一共展示了MessageCollection.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var tableComponentCollection = (TableComponentCollection)this.Object;
//Check for duplicate names
var nameList = new Dictionary<string, TableComponent>();
foreach (TableComponent component in tableComponentCollection)
{
var name = component.Name.ToLower();
if (nameList.ContainsKey(name))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextDuplicateName, component.Name), component.Controller);
else
nameList.Add(name, component);
}
//Check to ensure all items have at least one column
foreach (var component in tableComponentCollection.ToList())
{
if (component.Columns.Count == 0)
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextTableComponentNoColumns, component.Name), component.Controller);
}
}
//Check for duplicate names with tables
foreach (Table table in ((ModelRoot)tableComponentCollection.Root).Database.Tables)
{
if (nameList.ContainsKey(table.Name.ToLower()))
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextComponentTableDuplicateName, nameList[table.Name.ToLower()].Name), nameList[table.Name.ToLower()].Controller);
}
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例2: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var package = (Package)this.Object;
if(package.DisplayName.Trim() == "")
{
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextPackageRequiresDisplayName, this);
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例3: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var parameter = (Parameter)this.Object;
//Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(parameter.DatabaseName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, parameter.Name), this);
if (!ValidationHelper.ValidCodeIdentifier(parameter.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, parameter.Name), this);
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例4: Verify
public override MessageCollection Verify()
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
return retval;
}
示例5: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var customStoredProcedure = (CustomStoredProcedure)this.Object;
if (customStoredProcedure.Generated)
{
//Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(customStoredProcedure.DatabaseName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customStoredProcedure.Name), this);
if (!ValidationHelper.ValidCodeIdentifier(customStoredProcedure.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customStoredProcedure.Name), this);
//Check StoredProcedure SQL
if (!customStoredProcedure.IsExisting && string.IsNullOrEmpty(customStoredProcedure.SQL))
{
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextSQLRequired, this);
}
if (customStoredProcedure.IsExisting && string.IsNullOrEmpty(customStoredProcedure.DatabaseObjectName))
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextExistingSPNeedsDBName, customStoredProcedure.Name), this);
}
//Check that object has at least one generated column
//if (customStoredProcedure.GetColumns().Count(x => x.Generated) == 0)
// retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextColumnsRequired, this);
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例6: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var database = (Database)this.Object;
//Check valid name
//if (!ValidationHelper.ValidDatabaseIdenitifer(database.DatabaseName))
// retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidDatabase, this);
//Check Relations
var deleteList = new ArrayList();
var checkList = new ArrayList();
foreach (Relation relation in database.Relations)
{
var table1 = (Table)relation.ParentTableRef.Object;
var table2 = (Table)relation.ChildTableRef.Object;
if ((table1 != null) && (table2 != null))
{
var relationName = table1.Name + "." + table1.GetAbsoluteBaseTable().Name + "." + relation.PascalRoleName + "." + table2.Name;
if (checkList.Contains(relationName))
{
INHydrateModelObjectController controller = this;
var list = database.Relations.Find(relation.Key);
if (list.Length > 0)
{
var key = ((Relation)list.GetValue(0)).Key;
var nodeList = this.Node.Nodes.Find(key, true);
if (nodeList.Length > 0)
controller = ((ModelObjectTreeNode)nodeList[0]).Controller;
}
retval.Add(MessageTypeConstants.Error, String.Format(ValidationHelper.ErrorTextDuplicateRoleName, table1.Name, table2.Name), table1.Controller);
}
else
{
checkList.Add(relationName);
}
}
else
{
deleteList.Add(relation);
//TODO
//retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextRelationMustHaveParentChild, null);
}
}
//Remove errors
foreach (Relation relation in deleteList)
database.Relations.Remove(relation);
//Validate audit fields
var auditFieldList = new List<string>();
auditFieldList.Add(database.CreatedByColumnName);
if (!auditFieldList.Contains(database.CreatedDateColumnName))
auditFieldList.Add(database.CreatedDateColumnName);
if (!auditFieldList.Contains(database.ModifiedByColumnName))
auditFieldList.Add(database.ModifiedByColumnName);
if (!auditFieldList.Contains(database.ModifiedDateColumnName))
auditFieldList.Add(database.ModifiedDateColumnName);
if (!auditFieldList.Contains(database.TimestampColumnName))
auditFieldList.Add(database.TimestampColumnName);
if (auditFieldList.Count != 5)
{
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextAuditFieldsNotUnique, database.Controller);
}
else
{
auditFieldList = new List<string>();
auditFieldList.Add(database.CreatedByPascalName);
if (!auditFieldList.Contains(database.CreatedDatePascalName))
auditFieldList.Add(database.CreatedDatePascalName);
if (!auditFieldList.Contains(database.ModifiedByPascalName))
auditFieldList.Add(database.ModifiedByPascalName);
if (!auditFieldList.Contains(database.ModifiedDatePascalName))
auditFieldList.Add(database.ModifiedDatePascalName);
if (!auditFieldList.Contains(database.TimestampPascalName))
auditFieldList.Add(database.TimestampPascalName);
if (auditFieldList.Count != 5)
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextAuditFieldsNotUnique, database.Controller);
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例7: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var customRetrieveRule = (CustomRetrieveRule)this.Object;
//Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(customRetrieveRule.DatabaseName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customRetrieveRule.Name), this);
if (!ValidationHelper.ValidCodeIdentifier(customRetrieveRule.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customRetrieveRule.Name), this);
//Check SQL
if (string.IsNullOrEmpty(customRetrieveRule.SQL))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextSQLRequired, this);
return retval;
}
catch(Exception ex)
{
throw;
}
}
示例8: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
//Check for duplicate names
var nameList = new Hashtable();
var referenceCollection = (ReferenceCollection)this.Object;
foreach(Reference reference in referenceCollection)
{
var parameter = (Parameter)reference.Object;
var name = parameter.Name.ToLower();
if(nameList.ContainsKey(name))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextDuplicateName, name), parameter.Controller);
else
nameList.Add(name, string.Empty);
}
return retval;
}
catch(Exception ex)
{
throw;
}
}
示例9: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var tableComponent = (TableComponent)this.Object;
if (tableComponent.Generated)
{
#region Table Component must have PK for parent table
var pkCount = 0;
foreach (Reference reference in tableComponent.Columns)
{
var column = (Column)reference.Object;
if (tableComponent.Parent.PrimaryKeyColumns.Contains(column))
pkCount++;
}
if (pkCount != tableComponent.Parent.PrimaryKeyColumns.Count)
{
retval.Add(MessageTypeConstants.Error, String.Format(ValidationHelper.ErrorTextComponentMustHaveTablePK, tableComponent.Name), this);
}
#endregion
#region Check valid name
if (!ValidationHelper.ValidCodeIdentifier(tableComponent.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, tableComponent.Parent.Name), this);
#endregion
#region Check that object does not have same name as project
if (tableComponent.PascalName == ((ModelRoot)tableComponent.Parent.Root).ProjectName)
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextComponentProjectSameName, tableComponent.Parent.PascalName), this);
}
#endregion
#region Check for classes that will confict with generated classes
var classExtensions = new List<string>();
classExtensions.Add("collection");
classExtensions.Add("enumerator");
classExtensions.Add("query");
//classExtensions.Add("search");
classExtensions.Add("pagingfielditem");
classExtensions.Add("paging");
classExtensions.Add("primarykey");
classExtensions.Add("selectall");
classExtensions.Add("pagedselect");
classExtensions.Add("selectbypks");
classExtensions.Add("selectbycreateddaterange");
classExtensions.Add("selectbymodifieddaterange");
classExtensions.Add("selectbysearch");
classExtensions.Add("beforechangeeventargs");
classExtensions.Add("afterchangeeventargs");
foreach (var ending in classExtensions)
{
if (tableComponent.PascalName.ToLower().EndsWith(ending))
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextNameConfictsWithGeneratedCode, tableComponent.Parent.Name), this);
}
}
#endregion
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例10: Verify
public override MessageCollection Verify()
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var relation = (Relation)this.Object;
return retval;
}
示例11: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var tableCompositeCollection = (TableCompositeCollection)this.Object;
//Check for duplicate names
var nameList = new Hashtable();
foreach (TableComposite composite in tableCompositeCollection)
{
var name = composite.Name.ToLower();
if (nameList.ContainsKey(name))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextDuplicateName, composite.Name), composite.Controller);
else
nameList.Add(name, string.Empty);
}
foreach (TableComposite composite in tableCompositeCollection)
{
if (composite.Columns.Count == 0)
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextTableCompositeNoColumns, composite.Name), composite.Controller);
}
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例12: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
if (!(((ReferenceCollection)this.Object).Parent is Table))
return retval;
var referenceCollection = (ReferenceCollection)this.Object;
var columnList = new List<Column>();
foreach (Reference reference in referenceCollection)
{
var column = (Column)reference.Object;
columnList.Add(column);
}
//Check for duplicate names
var nameList = new Hashtable();
foreach (var column in columnList)
{
var name = column.Name.ToLower();
if (nameList.ContainsKey(name))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextDuplicateName, column.Name), column.Controller);
else
nameList.Add(name, string.Empty);
}
if (retval.Count == 0)
{
//Check for duplicate codefacades
nameList = new Hashtable();
foreach (var column in columnList)
{
var name = column.PascalName.ToLower();
if (nameList.ContainsKey(name))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextDuplicateCodeFacade, column.Name), column.Controller);
else
nameList.Add(name, string.Empty);
}
}
//Check for a primary key
var isPrimaryNull = false;
foreach (var column in columnList)
{
if (column.PrimaryKey)
{
//hasPrimary = true;
isPrimaryNull |= column.AllowNull;
}
}
//Check for field named created,modfied,timestamp as these are taken
foreach (var column in columnList)
{
var name = column.Name.ToLower().Replace("_", string.Empty);
var t = (Table)column.ParentTableRef.Object;
if (t.AllowCreateAudit)
{
//If there is a CreateAudit then no fields can be named the predined values
if (string.Compare(name, ((ModelRoot)column.Root).Database.CreatedByColumnName.Replace("_", ""), true) == 0)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextPreDefinedNameField, name), column.Controller);
else if (string.Compare(name, ((ModelRoot)column.Root).Database.CreatedDateColumnName.Replace("_", ""), true) == 0)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextPreDefinedNameField, name), column.Controller);
}
if (t.AllowModifiedAudit)
{
if (string.Compare(name, ((ModelRoot)column.Root).Database.ModifiedByColumnName.Replace("_", ""), true) == 0)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextPreDefinedNameField, name), column.Controller);
else if (string.Compare(name, ((ModelRoot)column.Root).Database.ModifiedDateColumnName.Replace("_", ""), true) == 0)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextPreDefinedNameField, name), column.Controller);
}
if (t.AllowTimestamp)
{
if (string.Compare(name, ((ModelRoot)column.Root).Database.TimestampColumnName.Replace("_", ""), true) == 0)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextPreDefinedNameField, name), column.Controller);
}
}
if (columnList.Count != 0)
{
var parentTable = (Table)columnList[0].ParentTableRef.Object;
if (parentTable.Generated)
{
//Make sure all PK are generated
if (parentTable.PrimaryKeyColumns.Count != columnList.Count(x => x.Generated && x.PrimaryKey == true))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextNoPrimaryKey, parentTable.Controller);
else if (parentTable.PrimaryKeyColumns.Count == 0)
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextNoPrimaryKey, parentTable.Controller);
else if (isPrimaryNull)
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextPrimaryKeyNull, parentTable.Controller);
}
}
return retval;
}
catch (Exception ex)
{
//.........这里部分代码省略.........
示例13: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var table = (Table)this.Object;
#region Remove invalid columns
var deleteRelationList = new List<Relation>();
foreach (var relation in ((ModelRoot)table.Root).Database.Relations.ToList())
{
if (relation.ParentTableRef == null)
deleteRelationList.Add(relation);
else if (relation.FkColumns.Count() == 0)
deleteRelationList.Add(relation);
else if (relation.ChildTableRef == null)
deleteRelationList.Add(relation);
else if (relation.FkColumns.Count() == 0)
deleteRelationList.Add(relation);
else
{
foreach (var tempRelation in ((Table)relation.ChildTableRef.Object).ChildRoleRelations)
{
if (tempRelation.ChildTableRef == null)
deleteRelationList.Add(relation);
else if (tempRelation.ChildTableRef.Object == null)
deleteRelationList.Add(relation);
else if (tempRelation.ParentTableRef == null)
deleteRelationList.Add(relation);
else if (tempRelation.ParentTableRef.Object == null)
deleteRelationList.Add(relation);
}
foreach (var column in relation.FkColumns)
{
if (column.ParentTableRef == null)
deleteRelationList.Add(relation);
}
}
}
#endregion
if (table.Generated)
{
var heirList = table.GetTableHierarchy();
#region Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(table.DatabaseName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, table.Name), this);
if (!ValidationHelper.ValidCodeIdentifier(table.PascalName) && (table.DatabaseName != table.PascalName)) //Not same name
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, table.Name), this);
#endregion
#region Check that non-key relationships have a unique index on fields
foreach (var reference in table.Relationships.ToList())
{
var relation = (Relation)reference.Object;
if (!relation.IsPrimaryKeyRelation())
{
foreach (ColumnRelationship columnRelationship in relation.ColumnRelationships)
{
var parentColumn = (Column)columnRelationship.ParentColumnRef.Object;
if (!parentColumn.IsUnique)
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextTableColumnNonPrimaryRelationNotUnique, parentColumn.DatabaseName, table.Name), this);
}
}
}
#endregion
#region Unit tests cannot be performed on base tables
if (table.AllowUnitTest != Table.UnitTestSettingsConstants.StubOnly)
{
if (table.Immutable)
{
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextTableDoesNotAllowModification, table.PascalName), this);
}
}
#endregion
#region Check that object has at least one generated column
if (table.GetColumns().Count(x => x.Generated) == 0)
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextColumnsRequired, this);
#endregion
#region Clean up bogus references (in case this happened)
var delReferences = new ArrayList();
//Verify that no column has same name as table
foreach (var column in table.GetColumns())
{
if (string.Compare(column.PascalName, table.PascalName, true) == 0)
{
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextTableColumnNameMatch + " (" + column.ToString() + ")", this);
}
}
//Verify relationships
foreach (var reference in table.Relationships.ToList())
//.........这里部分代码省略.........
示例14: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var root = (ModelRoot)this.Object;
//Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(root.CompanyName) || !ValidationHelper.ValidCodeIdentifier(root.CompanyName))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidCompany, this);
if (!ValidationHelper.ValidDatabaseIdenitifer(root.ProjectName) || !ValidationHelper.ValidCodeIdentifier(root.ProjectName))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidProject, this);
if (!ValidationHelper.ValidDatabaseIdenitifer(root.CompanyAbbreviation) || !ValidationHelper.ValidCodeIdentifier(root.CompanyAbbreviation))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidCompanyAbbreviation, this);
if (!string.IsNullOrEmpty(root.DefaultNamespace))
{
if (!ValidationHelper.IsValidNamespace(root.DefaultNamespace))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidNamespace, this);
}
return retval;
}
catch (Exception ex)
{
throw;
}
}
示例15: Verify
public override MessageCollection Verify()
{
try
{
var retval = new MessageCollection();
retval.AddRange(base.Verify());
var customViewColumn = (CustomViewColumn)this.Object;
//Check valid name
if (!ValidationHelper.ValidDatabaseIdenitifer(customViewColumn.DatabaseName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customViewColumn.Name), customViewColumn.Controller);
if (!ValidationHelper.ValidCodeIdentifier(customViewColumn.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customViewColumn.Name), customViewColumn.Controller);
if (!ValidationHelper.ValidFieldIdentifier(customViewColumn.PascalName))
retval.Add(MessageTypeConstants.Error, string.Format(ValidationHelper.ErrorTextInvalidIdentifier, customViewColumn.Name), customViewColumn.Controller);
//Check valid name
if ((!string.IsNullOrEmpty(customViewColumn.CodeFacade)) && !ValidationHelper.ValidDatabaseIdenitifer(customViewColumn.CodeFacade))
retval.Add(MessageTypeConstants.Error, ValidationHelper.ErrorTextInvalidCodeFacade, customViewColumn.Controller);
return retval;
}
catch(Exception ex)
{
throw;
}
}