-
Notifications
You must be signed in to change notification settings - Fork 0
Description
hello all
i have created a new project MVC5 in visual studio 2012 ultimate, all model class (Banque, Client,...etc), and entity framework context class BankDbContext.
i have oracle database 12c version
Since there is not a connection string in web.config on this example, i decided to use entity framework for accessing to oracle database. i downloaded by nuget and installed the oracle.ManagedDataAccess.EntityFramework, oracle.ManagedDataAccess and EntityFramework v6 packages and t alrered the connection string given by thes packages to
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="ORCL" descriptor="(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)" />
</dataSources>
</version>
</oracle.manageddataaccess.client>
<connectionStrings>
<add name="BankDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=bcdratest;Password=bcdratest;Data Source=ORCL" />
</connectionStrings>
after i have created the Initializer class:
namespace BankAccountsManagementSystem.DataAccessLayer
{
public class Initializer :DropCreateDatabaseAlways<BankDbContext>
{
protected override void Seed(BankDbContext context)
{
using(var ctx = new BankDbContext())
{
var banque = new Banque
{
Nom="ENIT Bank",
ArgentDepose = 0.0m,
Capital =0.0m,
NbreClients = 0,
NbreComptes=0,
NbreCredits=0,
SommeCredits = 0
};
ctx.Banques.Add(banque);
ctx.SaveChanges();
}
}
}
}
i have started by creating a BanquesController and Banques/Index view when i executed the application, the database is created in first time. after, i created PersonneMoralesController by scaffolding and altered the index Action by the code on this example
but when executing the application i get an exception:
ORA-00604: error occurred at recursive SQL level string 1
ORA-08177: can't serialize access for this transaction
and database is not recreated.
i thought that i have got these errors because of the codes in initializer and banque Controller Index Action, two transactions in same Banques table, so i excluded this Initializer Class File.
but even this, the problem persists when the exectioning of application
why and how to fix this?