Find
Example method Find.
Documentation
This example uses Oracle HR schema.
Code
Method that returns a model with all of her relationships.
//Method that returns a model with all of her relationships based on informed Id.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = ECRUD.Find<Employee>(200, DataBase.HR);
}
//Method that returns a model with all of her relationships based on informed Id with constructor parameters.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = ECRUD.Find<Employee>(200, DataBase.HR, new object[] { "Willian" });
}
//Method that returns a model with all of her relationships based on the specified condition (use table fields).
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = ECRUD.Find<Employee>("EMAIL = 'DOCONNEL'", DataBase.HR);
}
//Method that returns a model with all of her relationships based on the specified condition (use table fields) with constructor parameters.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = ECRUD.Find<Employee>("EMAIL = 'DOCONNEL'", DataBase.HR, new object[] { "Willian" });
}
Code Async
Method that returns a list of your model and its relationships asynchronous.
//Method that returns a model with all of her relationships based on informed Id.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = await ECRUD.FindAsync<Employee>(200, DataBase.HR);
}
//Method that returns a model with all of her relationships based on informed Id with constructor parameters.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = await ECRUD.FindAsync<Employee>(200, DataBase.HR, new object[] { "Willian" });
}
//Method that returns a model with all of her relationships based on the specified condition (use table fields).
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = await ECRUD.FindAsync<Employee>("EMAIL = 'DOCONNEL'", DataBase.HR);
}
//Method that returns a model with all of her relationships based on the specified condition (use table fields) with constructor parameters.
using (var ECRUD = new ECRUD.OracleMapping())
{
var Employee = await ECRUD.FindAsync<Employee>("EMAIL = 'DOCONNEL'", DataBase.HR, new object[] { "Willian" });
}