-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IdentityUser exposure #7
Comments
Thanks for the tips :) I didn't get the "Services" and "Specifications" idea well and how the string guid will map correctly to the correct user. It's late too here 😄 |
I think you should forget the specifications for now. They offer keeping the queries in your domain model, and then materialize by some outer infrastructure. The other benefit is that if you decide to change the ORM, you would have much less work to do. You would just rewrite/adjust the abstract repository and the spec evaluator. Trust me, you won't face these issues for a long time, so just drop it for now. I think was talking on the subject in few other threads. I would advise to drop the repository pattern in your projects as well for now. DbSets are already form of a repository, and DbContext is already Unit of Work. By creating repositories, you add abstraction on top of these abstractions. You should be sure if you really need that additional abstraction before using it. They would offer switching the ORM easily, which also you won't do it often in your projects (as for different DBs, Efcore already providing providers for most of them). |
@fiseni Thanks again :)
|
Yes, you might say that. But the size of the project is also not always a factor. Once you get familiar with all the concepts, it won't be a burden to do it even for small projects. What I wanna say is just get one step at a time. Initially try to grasp some more basic concepts (like why you shouldn't have IdentityUser property, etc). You also would be surprised that even for very large projects, there are people not using repository pattern. There are a lot of approaches, they would go for vertical modularity, feature based structures. Yes, exactly. Whenever you need more information for the user, you have the ID, and you just query the DB and get the whole user. This can be done within the controller, within some separate service etc. Don't be afraid to make some additional DB queries. There is always a trade off, in the name of better encapsulation, you will find yourself doing additional queries, and that's ok. |
Thanks. I'm really glad with your help here. One small question is I often see an |
Yes, it just sets your own user entity, for future upgrades. In
|
You might start refactoring the usage of IdentityUser in the models:
Ps. I'll add other hints tomorrow, kinda late here :)
The text was updated successfully, but these errors were encountered: