System.Data.XmlTreeGen.Save C# (CSharp) Method

Save() private method

private Save ( DataSet ds, DataTable dt, XmlWriter xw ) : void
ds DataSet
dt DataTable
xw XmlWriter
return void
        internal void Save(DataSet ds, DataTable dt, XmlWriter xw)
        {
            Save(ds, dt, xw, false);
        }

Same methods

XmlTreeGen::Save ( DataSet ds, DataTable dt, XmlWriter xw, bool writeHierarchy ) : void
XmlTreeGen::Save ( DataSet ds, DataTable dt, XmlWriter xw, bool writeHierarchy, string>.Converter multipleTargetConverter ) : void
XmlTreeGen::Save ( DataSet ds, XmlWriter xw ) : void
XmlTreeGen::Save ( DataTable dt, XmlWriter xw ) : void

Usage Example

示例#1
0
        public void WriteXmlSchema(XmlWriter writer, bool writeHierarchy)
        {
            IntPtr hscp;
            Bid.ScopeEnter(out hscp, "<ds.DataTable.WriteXmlSchema|API> %d#\n", ObjectID);
            try{
                if (this.tableName.Length == 0) {
                    throw ExceptionBuilder.CanNotSerializeDataTableWithEmptyName();
                }

                if (!CheckForClosureOnExpressions(this, writeHierarchy)) {
                    throw ExceptionBuilder.CanNotSerializeDataTableHierarchy();
                }

                DataSet ds = null;
                string tablenamespace = this.tableNamespace;//SQL BU Defect Tracking 286968

                // Generate SchemaTree and write it out
                if (null == this.DataSet) {
                    ds = new DataSet();
                    // if user set values on DataTable, it isn't necessary
                    // to set them on the DataSet because they won't be inherited
                    // but it is simpler to set them in both places

                    // if user did not set values on DataTable, it is required
                    // to set them on the DataSet so the table will inherit
                    // the value already on the Datatable
                    ds.SetLocaleValue(_culture, _cultureUserSet);
                    ds.CaseSensitive = this.CaseSensitive;
                    ds.Namespace = this.Namespace;
                    ds.RemotingFormat = this.RemotingFormat;
                    ds.Tables.Add(this);
                }

                if (writer != null) {
                    XmlTreeGen treeGen = new XmlTreeGen(SchemaFormat.Public);
                    treeGen.Save(null, this, writer, writeHierarchy);
                }
                if (null != ds) {
                    ds.Tables.Remove(this);
                    this.tableNamespace = tablenamespace;
                }
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }