Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Remove unused locals in System.Data.Common and keep some logic using discard #41962

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,6 @@ private void OnCollectionChanged(CollectionChangeEventArgs ccevent)
{
_table.UpdatePropertyDescriptorCollectionCache();

if ((null != ccevent) && !_table.SchemaLoading && !_table.fInitInProgress)
{
DataColumn column = (DataColumn)ccevent.Element;
}

CollectionChanged?.Invoke(this, ccevent);
}

Expand Down
5 changes: 2 additions & 3 deletions src/System.Data.Common/src/System/Data/XMLSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,8 @@ public void LoadSchema(XmlSchemaSet schemaSet, DataSet ds)
continue;
}

DataTable table = HandleTable(element);
stephentoub marked this conversation as resolved.
Show resolved Hide resolved
_ = HandleTable(element);

}

if (_dsElement != null)
Expand Down Expand Up @@ -2364,7 +2365,6 @@ internal void HandleElementColumn(XmlSchemaElement elem, DataTable table, bool i
// it should be user defined Named simple type
if (((XmlSchemaSimpleType)typeNode).Name != null && ((XmlSchemaSimpleType)typeNode).Name.Length != 0 && ((XmlSchemaSimpleType)typeNode).QualifiedName.Namespace != Keywords.XSDNS)
{
string targetNamespace = XSDSchema.GetMsdataAttribute(typeNode, Keywords.TARGETNAMESPACE);
strType = ((XmlSchemaSimpleType)typeNode).QualifiedName.ToString(); // use qualifed name
type = ParseDataType(strType);
}
Expand Down Expand Up @@ -2536,7 +2536,6 @@ internal void HandleDataSet(XmlSchemaElement node, bool isNewDataSet)
{
string dsName = node.Name;
string dsNamespace = node.QualifiedName.Namespace;
int initialTableCount = _ds.Tables.Count; // just use for inference backward compatablity

List<DataTable> tableSequenceList = new List<DataTable>();

Expand Down
10 changes: 2 additions & 8 deletions src/System.Data.Common/src/System/Data/xmlsaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ internal XmlElement SchemaTree(XmlDocument xd, DataTable dt)
_sRoot = rootSchema;
WriteSchemaRoot(xd, rootSchema, dt.Namespace);

XmlElement dsCompositor = FillDataSetElement(xd, null, dt);
_ = FillDataSetElement(xd, null, dt);

_constraintSeparator = xd.CreateElement(Keywords.XSD_PREFIX, "SHOULDNOTBEHERE", Keywords.XSDNS);
_dsElement.AppendChild(_constraintSeparator);
Expand Down Expand Up @@ -1493,8 +1493,7 @@ internal XmlElement HandleColumn(DataColumn col, XmlDocument dc, XmlElement sche
root.SetAttribute(Keywords.REF, _prefixes[col.Namespace] + ":" + col.EncodedColumnName);
if (col.Table.Namespace != _ds.Namespace)
{
string prefix = (string)_prefixes[col.Namespace];
XmlElement tNode = GetSchema(col.Table.Namespace);
_ = GetSchema(col.Table.Namespace);
}
}
}
Expand Down Expand Up @@ -2486,9 +2485,6 @@ private void GenerateRow(DataRow row)

string tablePrefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty;

// read value if the TextOnly column (if any)
object val = (table.XmlText == null ? DBNull.Value : row[table.XmlText, DataRowVersion.Original]);

//old row
_xmlw.WriteStartElement(tablePrefix, row.Table.EncodedTableName, row.Table.Namespace);

Expand Down Expand Up @@ -2774,8 +2770,6 @@ internal void SaveDiffgramData(XmlWriter xw, Hashtable rowsOrder)
_isDiffgram = true;
_rowsOrder = rowsOrder;

int countTopTable = _topLevelTables.Length;

string prefix = (_ds != null) ? ((_ds.Namespace.Length == 0) ? "" : _ds.Prefix) : ((_dt.Namespace.Length == 0) ? "" : _dt.Prefix);

if (_ds == null || _ds.DataSetName == null || _ds.DataSetName.Length == 0)
Expand Down