DynamicModel.GetValue(string columnName) Method
.NET Standard 2.x
Gets the value of the specified property (by name) in the DynamicModel
object.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public object GetValue(string columnName)
Parameters
columnName
System.String
The name of the property to get value.
Returns
System.Object
Returns the value of the specified property.
Examples
The following code example gets the value according to the property name in the DynamicModel
object.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.DynamicModelExamples
{
public class GetValueExample
{
private readonly SchoolContext _context;
public GetValueExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example3()
{
string sql;
sql = "select * from Course";
DynamicModel dynamicModel =
_context.SqlExecutor.SelectOne<DynamicModel>(sql);
// Gets the value of the "Title" property
var value = dynamicModel.GetValue("Title");
Console.WriteLine("Value = {0}", value);
/* The code example produces the following output:
Value = Chemistry
*/
}
}
}
Applies to
.NET Standard
2.x