I used edmx(Entity Data Model) to access Oracle DB in my .net project.
I can send data manuelly to db in this way.
Table1 tb1=new Table1();
using (Entities dbo = new Entities())
{
dbo.Table1.add(tb1);
dbo.SaveChanges();
}
But I try to send data dynamically to db in this way. For this reason I must invoke add method with reflection.
Type type = Type.GetType("Table1");
object reflectedTableInstance = Activator.CreateInstance(type);
using (Entities dbo = new Entities())
{
THİS İS MY ISSUE! reflectedType comes null in this way
Type reflectedType=Type.GetType("DbSet>TEntity>")
MethodInfo method= reflectedType.GetMethod("Add");
method.Invoke(reflectedInstance, new object{reflectedTableInstance })
dbo.SaveChanges();
}
Aucun commentaire:
Enregistrer un commentaire