EntityFramework 6 and mongodb and Identity

asp.net-identity-2 c# entity-framework mongodb


I am using WebAPi project and I would like to setup EntityFramework 6 with Mongodb.

I have setup my mongodb database and my entity framework code first model by following this link:


Now I would like to get Entity Framework and Asp.net Identity 2 to work together based on Mongodb. However, I cannot find any way ormodules that allow to do it. I found the following but it explains to uninstall entity framework.


So would you know a tuorial or would you have any experiences to enable mongodb for EF Code first and with IDentity working with?


8/19/2015 3:14:05 PM

Accepted Answer

Ok so I finally found a solution.

I am not using EF anymore.

I am using AspNet Identity Mongo with the V2 branch I compiled.


I am using MongoRepository for the repository of my Model.


And I have developed a DataService to manage my models CRUD operations.

 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; } }

And I am good.


8/22/2015 5:18:33 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow