C# Xamarin.Forms中的实体框架7

C# Xamarin.Forms中的实体框架7,c#,entity-framework,xamarin,xamarin.forms,C#,Entity Framework,Xamarin,Xamarin.forms,目前作为测试版提供,并声明可以(将?)在Xamarin项目中使用Entity Framework 7 但是,当我尝试使用NuGet安装它时: Install-Package EntityFramework.SQLite –Pre 它将失败: Install-Package : Could not install package 'EntityFramework.Sqlite 7.0.0-beta6'. You are trying to install this package into a

目前作为测试版提供,并声明可以(将?)在Xamarin项目中使用Entity Framework 7

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

Install-Package EntityFramework.SQLite –Pre
它将失败:

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
有没有办法在Xamarin项目中使用实体框架,或者我必须坚持使用实体框架

编辑:正如@Daniel Luberda所建议的,我刚刚尝试将Entity Framework安装到从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

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

我刚看了EF7 nupkg,看起来它们没有特定于平台的编译

这一点也得到了政府的证实,政府说:

11月份的候选版本(RC1)将是一个受支持的、可生产的跨平台版本。根据RC1的反馈,我们将根据需要提供其他候选版本

RC1目前计划在11月15日举行。您可能需要等待该版本,然后才能使用nuget包

与此同时。。。您可以尝试从构建源代码到目标PCL78,但我怀疑这不值得您花费时间


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

这是要求在EF 7或现在的EF core 1.0中实现的,但没有明确的路线图,也许如果更多的人在他们的应用程序中要求它,它会促使MS实现:

EF 7 Xamarin.表单支持


您是否尝试将其与共享项目而不是PCL项目一起使用?EF7仍处于测试阶段。不,我还没有测试,但我会的!提前感谢:)正如我在编辑中指出的,尝试将Entity Framework安装到从共享项目模板创建的项目中也不起作用。@HenrikIlgen您有没有让它起作用?我可能会尝试下载源代码以构建PCL版本。@AndresCastro我还没有,但我想尝试在Xamarin上测试Beta7。。。不幸的是,我现在真的没有时间。然而,如果你能让它工作,我真的对你的解决方案感兴趣!考虑到Xamarin现在归MS所有,你可能会认为这将成为路线图上的一部分。