private DesignIssueWarning getDesignIssueWarningForObjectNamedWithReservedWordssignIssueWarning(Model.Database database) { DesignIssueWarning warning = new DesignIssueWarning() { Description = "Database object names should not be reserved words", ReferenceUrl = new Uri("https://msdn.microsoft.com/en-us/library/ms189822(SQL.100).aspx") }; if (database == null) { return null; //cannot act on empty object } List<IDbObject> objectList = new List<IDbObject>(); if (this.reservedWords.Contains(database.ObjectName, StringComparer.OrdinalIgnoreCase)) { objectList.Add(database as IDbObject); } IList<IDbObject> allDbObjList = database.GetAllObjects(); // union objects to one collection to get one list to parse var nameViolations = ( from obj in allDbObjList where this.reservedWords.Contains(obj.ObjectName, StringComparer.OrdinalIgnoreCase) orderby obj.ObjectFullDisplayName select obj ).ToList(); objectList.AddRange(nameViolations); //do we have any objects? if (objectList.HasAny()) { warning.DatabaseObjects = objectList; } else { warning = null; } return warning; }
private DesignIssueWarning getDesignIssueForObjectsWithSpecialCharactersInName(Model.Database database) { DesignIssueWarning warning = new DesignIssueWarning() { Description = "Database object names should not contain special characters", ReferenceUrl = new Uri("https://msdn.microsoft.com/en-us/library/dd172134(v=vs.100).aspx") }; if (database == null) { return null; //cannot act on empty object } List<IDbObject> objectList = new List<IDbObject>(); // check Db name if (this.checkForSpecialCharacters(database.ObjectName)) { objectList.Add(database); } IList<IDbObject> allDbObjList = database.GetAllObjects(); foreach (IDbObject obj in allDbObjList) { if (this.checkForSpecialCharacters(obj.ObjectName)) { objectList.Add(obj); } } //do we have any objects? if (objectList.HasAny()) { warning.DatabaseObjects = objectList; } else { warning = null; } return warning; }