Using PetaPoco in Asp.NET Core MVC 6

天大地大妈咪最大 提交于 2020-01-07 03:40:13

问题


so i started trying out the new ASP.NET 5 Platform and have the following dependencies in my Project.json

"dependencies": {
    "System.Collections": "4.0.10-beta-23019",
    "System.Linq": "4.0.0-beta-23019",
    "System.Threading": "4.0.10-beta-23019",
    "System.Runtime": "4.0.10-beta-23019",
    "Microsoft.CSharp": "4.0.0-beta-23019",
    "PetaPoco.Core": "5.1.141-beta"
},

"frameworks": {
    "dnx451": { "dependencies": { "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5" } },
    "dnxcore50": { "dependencies": { "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5" } }
}

Everything builds fine but when i try to access anything from the PetaPoco namespace. Everything fails with the message.

The type or namespace PetaPoco could not be found, are you missing a using directive or an assembly reference.

I know what this means but even trying to import the namespace causes the same issue and I can see the library right there in the DNX4.5.1 AND DNX5.0 References

Please what Am i missing here

Thanks in advance


回答1:


You should be able to use PetaPoco with dnx451. However, you'll need to use the compiled nuget package, as the project structure has changed and the single file deploy won't be copying the source file to a valid location (My guess).

In addition and as per my comment, dnxcore50 (now .Net Core 1.0) is missing a component or two from the ado stack, which means PetaPoco won't work. However, targeting dnx451 should work.

Lastly, we'll mostly likely see PetaPoco builds for .NET/Asp.Net Core 1.0 after they release the RC2.




回答2:


You are missing that PetaPoco won't work with dnxcore50. Remove the following line to try out ASP.NET5 (or asp.net core as the new name is):

  "dnxcore50": { "dependencies": { "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5



回答3:


https://github.com/JCKodel/Core.ORM

In the folder __PETAPOCO/XCore there is a functional PetaPoco version that runs on dnxCore. All tests pass.



来源:https://stackoverflow.com/questions/35343435/using-petapoco-in-asp-net-core-mvc-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!