Setup MongoDB in VNext

孤人 提交于 2019-12-12 01:49:46

问题


I have some issues using MongoDB in the a VNext project

Link to github with code https://github.com/Mech0z/MagicDraftStatistics/tree/NewFeatures

If I use this package

mongocsharpdriver

Which is now obsolete, I get

Warning 'MongoClientExtensions.GetServer(MongoClient)' is obsolete: 'Use the new API instead.'

and 6 of these

Error The type or namespace name 'MongoServer' could not be found (are you missing a using directive or an assembly reference?)

And I am not sure if I need to change something in my project.json

    "dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta1",
    "Microsoft.AspNet.Diagnostics": "1.0.0.0-beta1",
    "Microsoft.AspNet.Mvc": "6.0.0-beta1",
    "mongocsharpdriver": "2.0.0.0-beta2"

The wierd thing is that the GUI do not show any errors, only the Error list

If I change to the new official driver then I cant get the same code to work, and the documentation for the driver dont seem to have changed http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-csharp-driver/

But I get


回答1:


For some odd reason it works when I remove "aspnetcore50": { } from frameworks. Not sure what implications that will have

{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
    "wwwroot"
],
"packExclude": [
    "**.kproj",
    "**.user",
    "**.vspscc"
],
"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta1",
    "Microsoft.AspNet.Diagnostics": "1.0.0.0-beta1",
    "Microsoft.AspNet.Mvc": "6.0.0-beta1",
    "mongocsharpdriver": "1.8.3"
},
"frameworks": {
    "aspnet50": { }
}
}


来源:https://stackoverflow.com/questions/28663047/setup-mongodb-in-vnext

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