Click here to Skip to main content
15,883,731 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I ask about if i can do something like that:

C#
//In classlib1.dll
class Context : IdentityDbContext<IdentityUser> 
{
    .............
}

//In classlib2.dll
class MyUser : IdentityUser
{
   extend IdentityUser.......
}


Dependency injection registration:
=> When you find "IdentityUser" use "MyUser"
Posted
Updated 10-May-15 3:02am
v2
Comments
Sergey Alexandrovich Kryukov 10-May-15 11:09am    
Sorry, as formulated, the question sounds like total gibberish. We can only guess how on class is related to another one. How is it related to dependency injection. Dependency injection, or any other pattern, cannot be a goal, it may or may not be a part of some solution. But of what problem? You did not explain it.

Do you want to create some class which uses IdentifyUser and derived classes in the way abstracted from the concrete type but using the common interface described by IdentityUser? But then do exactly that, not looking at any patterns...

—SA

1 solution

Please see my comment to the question. As your post does not make a real question, there is nothing to answer to.

However, I can give you a couple of hints. First, did you pay attention that you Content class is non-generic? Why? Secondly, here is how the derived classes are abstracted:
C#
class SomethingGeneric<IDENTITY>
    where IDENTITY : IdentityUser
{
    // ...
}

or, say,
C#
class IdentityDbContext<t> { /* ... */ }

class SomethingGeneric<IDENTITY> : IdentityDbContext<IDENTITY>
    where IDENTITY : IdentityUser
{
    // ...
}


Disclaimer: These are only some hints; they might become unrelated to the question, which is not really formulated.

Any questions?

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900