I want to write an web-api with oracle database as my back-end and Dapper as ORM.
I have installed odac.client.x86 and Oracle.ManagedDataAccess and dapper libraries from the nuget package manager. I can able to connect my database from server explorer as shown in below image.
Next i had added a Web Api2 empty controller to my project. This is my connection string Source=Oracle_test;Persist Security Info=True;User ID=tams;Password=***********;Unicode=True.
And my code is
public IHttpActionResult Get()
{
using (OracleConnection db = new OracleConnection("Data Source = Oracle_test; Persist Security Info = True; User ID = tams; Password = tams; Unicode = True"))
{
db.Open();
dynamic result = db.Query("Select NAME from APPLICANT_BATCHES").SingleOrDefault();
return Ok(result);
}
}
i am getting exception as TypeInitializationException as shown in below image
I am new to dapper and oracle database please help me to connect to my oracle databse and getting results with dapper orm in c#.
My database version is - 11.2.0.1.0 Oracle Database 11g Release 11.2.0.1.0 - 64bit Production