2016-08-16 3 views
4

https://github.com/attilah/AngularJSAuthenticationからmongoドライババージョン2を使用するようにプロジェクトを変換しようとしていますので、現在のプロジェクトに適応できます。Web api 2とMongodb v2サンプルコードをドライババージョン2を使用して移行します

私はマイグレーションがほぼ完了しましたが、私はウェブAPIバージョン2とmongodbに新しいバージョンが入っているので、変換方法はわからないファイルがいくつかあります。

私が問題に直面しています問題は、次のとおりです。

  1. ApplicationIdentityContext.cs
  2. ApplicationUserManager.cs私のように試してみましたApplicationIdentityContext.csと例えば
  3. ApplicationRoleManager.cs

次のコードは、エラーが表示され、私はこの点に立ち往生する:

namespace AngularJSAuthentication.API 
{ 
    using Entities; 
    using Microsoft.AspNet.Identity.EntityFramework; 
    using MongoDB.Driver; 
    public class ApplicationIdentityContext : IdentityDbContext 
    { 
     public ApplicationIdentityContext(IMongoContext mongoContext) 
      : this(mongoContext.Users, mongoContext.Roles) 
     { 
     } 

     public ApplicationIdentityContext(IMongoCollection<User> users, IMongoCollection<Role> roles) 
      : base(users, roles) 

     { 
     } 
    } 
} 

と私はプログラムの構築時に、エディタは私にエラーを示しています。ここでは

Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'MongoDB.Driver.IMongoCollection<AngularJSAuthentication.API.Entities.User>' to 'System.Data.Common.DbConnection' AngularJSAuthentication.API D:\Projects\AngularJSAuthentication-master\AngularJSAuthentication.API\ApplicationIdentityContext.cs 14 Active

は私のレポです:https://github.com/skanel/Angular2-WebApi2-Mongodb2-Authentication

あなたが任意のアイデアを持っていますか?

+0

(http://stackoverflow.com/questions/38914303/identitycontext-could-not-be-found-are-you-不足している指示を使用しています/ 39042599#39042599) 私はそこに私の2セントに答えました。ケアは見ていますか? –

+0

https://github.com/skanel/Angular2-WebApi2-Mongodb2-Authentication – kn3l

答えて

4

1.9から2. +に変更されたようです。パッケージ

AspNet.Identity.MongoDBは新しいmongoドライババージョン2+と互換性がありません。

そこでエラー:この質問は、[この]に重複する可能性のように見えます'cannot convert from 'MongoDB.Driver.IMongoCollection<AngularJSAuthentication.API.Entities.User>' to 'System.Data.Common.DbConnection'

+0

どのような解決策でも、私はここで試してみました。https://github.com/skanel/Angular2-WebApi2-Mongodb2-Authentication – kn3l

+1

私はあなたにレポ、チェックアウトしてください。 –

関連する問題