本文整理汇总了C#中System.Data.DataSet.SetLocaleValue方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.SetLocaleValue方法的具体用法?C# DataSet.SetLocaleValue怎么用?C# DataSet.SetLocaleValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了DataSet.SetLocaleValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadXmlSchema
internal void ReadXmlSchema(XmlReader reader, bool denyResolving)
{
IntPtr hscp;
Bid.ScopeEnter(out hscp, "<ds.DataTable.ReadXmlSchema|INFO> %d#, denyResolving=%d{bool}\n", ObjectID, denyResolving);
try{
DataSet ds = new DataSet();
SerializationFormat cachedRemotingFormat = this.RemotingFormat;
// fxcop: ReadXmlSchema will provide the CaseSensitive, Locale, Namespace information
ds.ReadXmlSchema(reader, denyResolving);
string CurrentTableFullName = ds.MainTableName;
if (Common.ADP.IsEmpty(this.tableName) && Common.ADP.IsEmpty(CurrentTableFullName))
return;
DataTable currentTable = null;
if (!Common.ADP.IsEmpty(this.tableName)) {
if (!Common.ADP.IsEmpty(this.Namespace)) {
currentTable = ds.Tables[this.tableName, this.Namespace];
}
else {//SQL BU defect tracking 240293
int tableIndex = ds.Tables.InternalIndexOf(this.tableName);
if (tableIndex > -1) {
currentTable = ds.Tables[tableIndex];
}
}
}
else{ //!Common.ADP.IsEmpty(CurrentTableFullName)
string CurrentTableNamespace = "";
int nsSeperator = CurrentTableFullName.IndexOf(':');
if (nsSeperator > -1) {
CurrentTableNamespace = CurrentTableFullName.Substring(0, nsSeperator);
}
string CurrentTableName = CurrentTableFullName.Substring(nsSeperator + 1, CurrentTableFullName.Length - nsSeperator -1);
currentTable = ds.Tables[CurrentTableName, CurrentTableNamespace];
}
if (currentTable == null) { // bug fix :99186
string qTableName = string.Empty;
if (!Common.ADP.IsEmpty(this.tableName)) {
qTableName = (this.Namespace.Length > 0)? (this.Namespace + ":" + this.tableName):this.tableName;
}
else {
qTableName = CurrentTableFullName ;
}
throw ExceptionBuilder.TableNotFound(qTableName);
}
currentTable._remotingFormat = cachedRemotingFormat;
List<DataTable> tableList = new List<DataTable>();
tableList.Add(currentTable);
CreateTableList(currentTable, tableList);
List<DataRelation> relationList = new List<DataRelation>();
CreateRelationList(tableList, relationList);
if (relationList.Count == 0) {
if (this.Columns.Count == 0) {
DataTable tempTable = currentTable;
if (tempTable != null)
tempTable.CloneTo(this, null, false); // we may have issue Amir
if (this.DataSet == null && this.tableNamespace == null) { // webdata 105506
// for standalone table, clone wont get these correctly, since they may come with inheritance
this.tableNamespace = tempTable.Namespace;
}
}
return;
}
else {
if (Common.ADP.IsEmpty(this.TableName)) {
this.TableName = currentTable.TableName;
if (!Common.ADP.IsEmpty(currentTable.Namespace)) {
this.Namespace = currentTable.Namespace;
}
}
if (this.DataSet == null) {
DataSet dataset = new DataSet(ds.DataSetName);
// webdata 105506
// 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
dataset.SetLocaleValue(ds.Locale, ds.ShouldSerializeLocale());
dataset.CaseSensitive = ds.CaseSensitive;
dataset.Namespace = ds.Namespace;
dataset.mainTableName = ds.mainTableName;
dataset.RemotingFormat = ds.RemotingFormat;
dataset.Tables.Add(this);
}
DataTable targetTable = CloneHierarchy(currentTable, this.DataSet, null);
foreach(DataTable tempTable in tableList) {
DataTable destinationTable = this.DataSet.Tables[tempTable.tableName, tempTable.Namespace];
//.........这里部分代码省略.........
示例2: WriteXmlSchema
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);
}
}
示例3: SerializeDataTable
// Serialize the table schema and data.
private void SerializeDataTable(SerializationInfo info, StreamingContext context, bool isSingleTable, SerializationFormat remotingFormat) {
info.AddValue("DataTable.RemotingVersion", new Version(2, 0));
// SqlHotFix 299, SerializationFormat enumeration types don't exist in V1.1 SP1
if (SerializationFormat.Xml != remotingFormat) {
info.AddValue("DataTable.RemotingFormat", remotingFormat);
}
if (remotingFormat != SerializationFormat.Xml) {//Binary
SerializeTableSchema(info, context, isSingleTable);
if (isSingleTable) {
SerializeTableData(info, context, 0);
}
} else {//XML/V1.0/V1.1
string tempDSNamespace = "";
Boolean fCreatedDataSet = false;
if (dataSet == null) {
DataSet ds = new DataSet("tmpDataSet");
// 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.namespaceURI = this.Namespace;
Debug.Assert(ds.RemotingFormat == SerializationFormat.Xml, "RemotingFormat must be SerializationFormat.Xml");
ds.Tables.Add(this);
fCreatedDataSet = true;
} else {
tempDSNamespace = this.DataSet.Namespace;
this.DataSet.namespaceURI = this.Namespace; //this.DataSet.Namespace = this.Namespace; ??
}
info.AddValue(KEY_XMLSCHEMA, dataSet.GetXmlSchemaForRemoting(this));
info.AddValue(KEY_XMLDIFFGRAM, dataSet.GetRemotingDiffGram(this));
if (fCreatedDataSet) {
dataSet.Tables.Remove(this);
}
else{
dataSet.namespaceURI = tempDSNamespace;
}
}
}
示例4: WriteXml
public void WriteXml(XmlWriter writer, XmlWriteMode mode, bool writeHierarchy)
{
IntPtr hscp;
Bid.ScopeEnter(out hscp, "<ds.DataTable.WriteXml|API> %d#, mode=%d{ds.XmlWriteMode}\n", ObjectID, (int)mode);
try{
if (this.tableName.Length == 0) {
throw ExceptionBuilder.CanNotSerializeDataTableWithEmptyName();
}
// Generate SchemaTree and write it out
if (writer != null) {
if (mode == XmlWriteMode.DiffGram) { // FIX THIS
// Create and save the updates
new NewDiffgramGen(this, writeHierarchy).Save(writer, this);
}
else {
// Create and save xml data
if (mode == XmlWriteMode.WriteSchema) {
DataSet ds = null;
string tablenamespace = this.tableNamespace;
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) {
XmlDataTreeWriter xmldataWriter = new XmlDataTreeWriter(this, writeHierarchy);
xmldataWriter.Save(writer, /*mode == XmlWriteMode.WriteSchema*/true);
}
if (null != ds) {
ds.Tables.Remove(this);
this.tableNamespace = tablenamespace;
}
}
else {
XmlDataTreeWriter xmldataWriter = new XmlDataTreeWriter(this, writeHierarchy);
xmldataWriter.Save(writer,/*mode == XmlWriteMode.WriteSchema*/ false);
}
}
}
}
finally {
Bid.ScopeLeave(ref hscp);
}
}
示例5: WriteXml
public void WriteXml(XmlWriter writer, XmlWriteMode mode, bool writeHierarchy)
{
long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTable.WriteXml|API> {0}, mode={1}", ObjectID, mode);
try
{
if (_tableName.Length == 0)
{
throw ExceptionBuilder.CanNotSerializeDataTableWithEmptyName();
}
// Generate SchemaTree and write it out
if (writer != null)
{
if (mode == XmlWriteMode.DiffGram)
{
// Create and save the updates
new NewDiffgramGen(this, writeHierarchy).Save(writer, this);
}
else
{
// Create and save xml data
if (mode == XmlWriteMode.WriteSchema)
{
DataSet ds = null;
string tablenamespace = _tableNamespace;
if (null == 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 = CaseSensitive;
ds.Namespace = Namespace;
ds.RemotingFormat = RemotingFormat;
ds.Tables.Add(this);
}
if (writer != null)
{
XmlDataTreeWriter xmldataWriter = new XmlDataTreeWriter(this, writeHierarchy);
xmldataWriter.Save(writer, /*mode == XmlWriteMode.WriteSchema*/true);
}
if (null != ds)
{
ds.Tables.Remove(this);
_tableNamespace = tablenamespace;
}
}
else
{
XmlDataTreeWriter xmldataWriter = new XmlDataTreeWriter(this, writeHierarchy);
xmldataWriter.Save(writer,/*mode == XmlWriteMode.WriteSchema*/ false);
}
}
}
}
finally
{
DataCommonEventSource.Log.ExitScope(logScopeId);
}
}