我首先用EF5代码编写了一个项目(MVC 4)和一个Oracle数据库,我按照Oracle程序(以及这里的提示),经过多次尝试,无法使一切正常工作。
我在这里:
套餐:
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="odp.net.x86" version="112.3.0" targetFramework="net45" />
Web.config:
<connectionStrings>
<add name='Context' connectionString="DATA SOURCE=**.**.**.**:1521/FOLIO;PERSIST SECURITY INFO=True;Connection Lifetime=10;USER ID=*****;Password=*****;" providerName='Oracle.DataAccess.Client' />
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.DataAccess.Client" />
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
我的DataTable映射:
Folio
{
[Table("USERS", Schema = "FOLIO")]
public class Users
{
[Key]
[Column("USR_CODE")]
public string USR_CODE { get; set; }
[Required]
[Column("USR_NAME")]
public string USR_NAME { get; set; }
[Required]
[Column("USR_FIRSTNAME")]
public string USR_FIRSTNAME { get; set; }
[Required]
[Column("USR_INITIALS")]
public string USR_INITIALS { get; set; }
[Required]
[Column("USR_PASSWORD")]
public string USR_PASSWORD { get; set; }
}
}
不幸的是,我仍有相同的例外:
“访问数据时出错”
以下是详细信息:
[DalException: Une erreur est survenue lors de l'accès aux données]
Portfolio.Oracle.Service.BaseService.ManageError(Exception ex) in c:\Users\FEVRE\Documents\Visual Studio 2012\Projects\Portfolio.Oracle.Mvc\Portfolio.Oracle.Service\BaseService.cs:88
Portfolio.Oracle.Service.ProjectService.GetProjects() in c:\Users\FEVRE\Documents\Visual Studio 2012\Projects\Portfolio.Oracle.Mvc\Portfolio.Oracle.Service\ProjectService.cs:22
Portfolio.Oracle.Mvc.Controllers.HomeController.Index() in c:\Users\FEVRE\Documents\Visual Studio 2012\Projects\Portfolio.Oracle.Mvc\Portfolio.Oracle.Mvc\Controllers\HomeController.cs:32
lambda_method(Closure , ControllerBase , Object[] ) +101
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +211
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514928
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
我不明白,我找不到问题(EF?)
我在这里看到了:Using Oracle with EF code first
答案 0 :(得分:0)
Oracle与Code First不兼容。今年夏天将发布一款针对Oracle的EF6客户端测试版,该测试版将首先发布