IDataStoreBase.GetTemplate() Method
.NET Standard 2.x
Gets the default XML format template for DataStore data export.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
IDataTemplate GetTemplate();
Returns
SnapObjects.Data.IDataTemplate
XML format template.
Examples
Gets the default XML format template for DataStore data export.
using DWNet.Data;
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
public class GetTemplateExample
{
private readonly SchoolContext _context;
public GetTemplateExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example1()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// Gets the default XML format template for DataStore data export.
var template = datastore.GetTemplate();
var xml = TemplateExporter.Export(datastore, template);
Console.WriteLine("Template Content:{0}", template.Content);
Console.WriteLine("Xml:{0}", xml);
/*This code produces the following output:
Template Content:
<?xml version="1.0" encoding="UTF-16LE" standalone="no"?>
<d_department>
@foreach
{
<d_department_row>
<departmentid>@(departmentid)</departmentid>
<name att1="@(name)">@(name)</name>
<budget>@(budget)</budget>
<startdate>@(startdate)</startdate>
<administrator>@(administrator)</administrator>
</d_department_row>
}
</d_department>
Xml:
<?xml version="1.0" encoding="UTF-16LE" standalone="no"?>
<d_department>
<d_department_row>
<departmentid>1</departmentid>
<name att1="Engineering">Engineering</name>
<budget>350000.0000</budget>
<startdate>2007-09-01T00:00:00</startdate>
<administrator>2</administrator>
</d_department_row>
......
</d_department>
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x