IDataStore.GetValidate(string column) Method
.NET Standard 2.x
Gets the validation rule for a column (specified by the column name) in the DataStore. This validation rule will be checked when calling the Update
or Validate
method.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public string GetValidate(string column);
Parameters
column
System.String
The name of the column to get data.
Returns
System.String
Returns the validation rule for the specified column.
Examples
The following code example demonstrates how to get the validation rule for the departmentid column.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetValidateExample
{
private readonly SchoolContext _context;
public GetValidateExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example2()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// Sets the validation rule for the departmentid column:
// value must be larger than 0.
datastore.SetValidate(0, "departmentid > 0");
// The lower bound of column is 0.
// Gets the validation rules for the departmentid column.
string validation_rule = datastore.GetValidate("departmentid");
Console.WriteLine("Validation Rule: {0}", validation_rule);
/*This code produces the following output:
Validation Rule: departmentid > 0:
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department