EntityFramework 6和mongodb和Identity

dal*_*on5 5 c# entity-framework mongodb asp.net-identity-2

我正在使用WebAPi项目,我想用Mongodb设置EntityFramework 6.

我通过以下链接设置了我的mongodb数据库和我的实体框架代码第一个模型:

http://cdn.rssbus.com/help/DG1/ado/pg_efCodeFirst.htm

现在我想让Entity Framework和Asp.net Identity 2基于Mongodb一起工作.但是,我找不到允许这样做的任何方式或模块.我找到了以下内容,但它解释了卸载实体框架.

https://github.com/g0t4/aspnet-identity-mongo

那么你是否知道一个tuorial或者你是否有任何经验可以首先启用mongodb for EF Code并与IDentity合作?

谢谢,

dal*_*on5 7

好的,我终于找到了解决方案.

我不再使用EF了.

我使用AspNet Identity Mongo和我编译的V2分支.

https://github.com/InspectorIT/MongoDB.AspNet.Identity/tree/v2

我正在使用MongoRepository作为我的Model的存储库.

https://github.com/RobThree/MongoRepository

我开发了一个DataService来管理我的模型CRUD操作.

 public class DataService
{
    public static MongoRepository<ModelClass> ModelClass{ get { return Singleton<MongoRepository<ModelClass>>.Instance; } }


}

public class Singleton<T> where T : class, new()
{
    Singleton() { }

    private static readonly Lazy<T> instance = new Lazy<T>(() => new T());

    public static T Instance { get { return instance.Value; } }
}
Run Code Online (Sandbox Code Playgroud)

而且我很好.

谢谢,