Oracle datebase connectced through Entity Framework ( C# VS 2015 database-first) error -


i'm bit new entity framework , trying connect oracle database through entity framework. using visual studio 2015 entity framework wizard, created database reverse engineering our current database. when start debugging had error:

an unhandled exception of type 'system.invalidoperationexception' occurred in entityframework.dll

additional information: context cannot used while model being created. exception may thrown if context used inside onmodelcreating method or if same context instance accessed multiple threads concurrently. note instance members of dbcontext , related classes not guaranteed thread safe.

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using librarydll.dal; namespace librarydll {     public class class1     {              public void testdb()         {             using (entitiesdbtest db = new entitiesdbtest())             {                 list<book> books = db.books.tolist(); // <-- error                 list<user> users = db.users.tolist();                 list<history> histories = db.histories.tolist();             }         }     } } 

the code below generated template.

namespace librarydll.dal {     using system;     using system.collections.generic;      public partial class book     {         public book()         {             this.histories = new hashset<history>();         }          public int bookid { get; set; }         public string authorfirstname { get; set; }         public string authorlastname { get; set; }         public string title { get; set; }         public string shortdescription { get; set; }         public string longdescription { get; set; }          public virtual icollection<history> histories { get; set; }     } } 

how can fix it?

check if have included following configs in app.config file

<configuration>  <entityframework>   <providers>    <provider invariantname="oracle.manageddataaccess.client" type="oracle.manageddataaccess.entityframework.eforacleproviderservices, oracle.manageddataaccess.entityframework, version=4.121.2.0, culture=neutral, publickeytoken=89b483f429c47342" /> 

and

<configuration>  <configsections>   <section name="oracle.manageddataaccess.client" type="oracleinternal.common.odpmsectionhandler, oracle.manageddataaccess, version=4.121.2.0, culture=neutral, publickeytoken=89b483f429c47342" /> 

edit:

it's idea move this

<startup>          <supportedruntime version="v4.0" sku=".netframework,version=v4.5.2" /> </startup> 

down bottom of configuration tag.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -