Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When is it right to use ASP.Net Identity?
When you're Making a single store or single role based app like the Music store, or an Internal Process site?

Should I really be using Identity if I want to add Parent Customers that have more than 1 user? If I want to be adding Discount Codes? A Full Shopping Experience?

How much can you really Customize the user, and how would you link them to Parent Users, how would you allow shipping to multiple address? Or keep a record of them.

What I have tried:

Well I learned Lots about Identity, and Making Roles..
But linking users to Parent Users or Companies doesn't seem to work the way I expected. Multiple Address didn't work as expected too.
Posted
Updated 17-Jun-19 9:33am

Identity really just handles users, logins, roles, and basic profile info. If you're building something like an ecommerce on top of that, you'll need to implement any additional logic yourself. Users are just rows in a database with a GUID ID so if you want to attach a basket to a user you just have a "UserID" field in your Basket table that contains the ID of the current user. If you want to group users into parents and children then again just create a table that has ParentID and ChildID and manage the data yourself. You can probably extend the user profiles to contain addresses but it's a bad idea. Again just create an Address table that contains the fields you need and store the UserID in that as well.
 
Share this answer
 
Comments
juan_van 14-Jun-19 11:33am    
Should I just use Identity to personal information,
Then anything Address, CC, SSN, Etc should be in the App Data..
Ya know now I say this, it make more sense to have the rest of that in the App since it would be work to pull it out if I changed some app login details.

Ok going to Code :)
F-ES Sitecore 14-Jun-19 11:45am    
I'd use it to just manage the username, password and roles, and manage everything else in your own tables.
juan_van 17-Jun-19 15:33pm    
I guess I was looking for more Than it's own table, I was more questioning the DbContext Settings, and how to link them with out Mucking up an IdentityDbContext Object.

You can use Identity on simple sites, complex sites, or even a complex family of sites.

The first time I used it was in it's infancy; and it was used in conjunction with the profile and role providers. It was a little overkill as there was only a handful of users.
My current employer has been using this forever; and our last incantation is as an OpenID provider for an enterprise B2B eCommerce application doing > 1 billion USD annually.


The key to success is not only knowing how it works; you also need to know what your needs are and hwo you plan to implement. My first experience was a waste of time as it was overkill for its purpose.
 
Share this answer
 
v2
Took to looking for more answers today, and found this on Microsoft's Best Practices.
[ASP.NET Core application architecture guidance]

This Microsoft Example on Github have 2 DbContext - Many of the projects I found on Gihub and other's have the
C#
ProductDbContext : IdentityDbContext<AppUser...>
DbSet<Order> Orders {get; set;}


Thank's for the Input!
 
Share this answer
 

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