Xamarin.Forms中的实体框架7

Hen*_*gen 7 c# entity-framework xamarin xamarin.forms

实体框架7目前作为Beta版本提供,本文指出在Xamarin项目中使用Entity Framework 7是可能的(将会是?).

但是,当我尝试使用NuGet安装它时:

Install-Package EntityFramework.SQLite –Pre
Run Code Online (Sandbox Code Playgroud)

它会失败:

Install-Package : Could not install package 'EntityFramework.Sqlite 7.0.0-beta6'. You are trying to install this package into a 
project that targets '.NETPortable,Version=v4.5,Profile=Profile78', but the package does not contain any assembly references or 
content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package EntityFramework.SQLite –Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)

有没有办法在Xamarin项目中使用Entity Framework,还是我必须坚持使用sqlite-net

编辑:正如@Daniel Luberda建议的那样,我只是尝试将实体框架安装到从Xamarin.Forms共享项目模板创建的项目中,但是这失败并出现以下错误:

Install-Package : Could not install package 'System.Runtime 4.0.20-beta-23109'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v5.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package EntityFramework.SQLite –Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)

Windows Phone项目和iOS项目也是如此.

Ste*_*rov 7

我只看了EF7 nupkg,看起来他们没有特定于平台的编译.

路线图也证实了这一点,该路线图说:

11月发布的候选版本(RC1)将是一个支持和生产就绪的跨平台版本.根据RC1的反馈,我们将根据需要发布其他候选版本.

RC1目前定于2015年11月.在使用nuget软件包之前,您可能需要等待该版本.

同时......你可以尝试从github构建源代码到目标PCL 78,但我怀疑它不值得你的时间.

在任何一种情况下,如果您遵循良好的MVVM实践,您应该能够构建应用程序的大部分内容并根据需要替换数据接口.