2015-08-25 105 views
6

Entity Framework 7目前作爲一個Beta版和this article說,它是(會?)可以使用實體框架7 Xamarin項目。實體框架7 Xamarin.Forms

然而,當我嘗試使用的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項目中使用實體框架或我將不得不堅持與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 

同對於Windows Phone項目和iOS項目是如此。

+0

你嘗試與共享項目,而不是PCL項目中使用它? EF7仍處於測試階段。 –

+0

不,我還沒有測試過,但我會!在此先感謝:) –

+0

正如我在編輯中指出的那樣,嘗試將實體框架安裝到從共享項目模板創建的項目中也無效。 –

回答

6

我只是看着EF7 nupkg,它看起來並不像平臺特定的編譯。

這也是由roadmap,它說證實:

The November release candidate (RC1) will be a supported and production ready cross-platform release. Depending on feedback from RC1 we will ship additional release candidates as necessary.

RC1目前預定Nov'15。您可能需要等待該版本才能使用nuget軟件包。

與此同時......您可以嘗試構建github的源代碼以鎖定PCL 78,但我懷疑它不值得你花時間。

在任何情況下,如果您遵循良好的MVVM實踐,您應該能夠構建應用程序的實質部分並根據需要替換數據接口。

2

這是問EF 7,或現在EF核心1.0中實現,但是沒有明確的路線圖,也許如果更多的人在他們的要求,它會促使MS使它:

EF 7個Xamarin.Forms支持

https://github.com/aspnet/EntityFramework/issues/4269

+1

考慮到Xamarin現在歸MS所有,你會認​​爲這將在路線圖上。 – TravisO