Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to cast UserStore<IdentityUser> to its base class IUserStore<IUser>?
    text
    copied!<p>I am trying to use the new asp.net identity provider with my abstraction layer of my models domain, wich have a implementation of Entity Framework, so I would like to use the out of box version of identity with entity framework in my data access layer.</p> <p>How can I convert an </p> <pre><code>UserStore&lt;IdentityUser&gt; </code></pre> <p>to its base interface</p> <pre><code>IUserStore&lt;IUser&gt; </code></pre> <p>Once UserStore is an implementation of IUserStore, I can get the cast by this:</p> <pre><code>UserStore&lt;IdentityUser&gt; as IUserStore&lt;IdentityUser&gt; </code></pre> <p>But I want to avoid the IdentityUser from EntityFramework references and dependences, to keep my domain layer loosely coupled. So, IdentityUser also are an implementation of IUser I can cast it:</p> <pre><code>IdentityUser as IUser </code></pre> <p>Both cases works, then I would like to do some like this (wich in fact doesnt works directly):</p> <pre><code>UserStore&lt;IdentityUser&gt; as IUserStore&lt;IUser&gt; </code></pre> <p>So, how can I achieve this?</p> <p>If we look at this <a href="http://i3.asp.net/media/4459023/1.png" rel="nofollow">diagram</a> <a href="http://i3.asp.net/media/4459023/1.png" rel="nofollow">http://i3.asp.net/media/4459023/1.png</a>, we will see what I would like to achieve. Referencing just the Microsoft.AspNet.Identity.Core in my domain layer, but using Microsoft.AspNet.Identity.EntityFramework implementation at DataAccess layer by returning the core interfaces for the domain layer. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload