I am developing an application in Asp.Net Core. Without Entity Framework, but with a SQL Database. I have found a great example from a previous answered question: https://github.com/MatthewKing/IdentityWithoutEF
My question is, I can see a ExampleUserStore.cs class but the ManageController.cs is currently not using this, it is using the UserManager type to perform actions on the user.
In order to create my own Stored Procedure to create the user (CreateAsync) where will I add this call / how do I adapt this to work without EF. Can I still use the UserManager with manual Stored Procedure calls?
EDIT: I have found the below in Startup.cs that I believe registers the services.
var userStore = new ExampleUserStore();
var roleStore = new ExampleRoleStore();
var userPrincipalFactory = new ExampleUserPrincipalFactory();
Services.AddSingleton<IUserStore<ApplicationUser>>(userStore);
Services.AddSingleton<IRoleStore<ApplicationRole>>(roleStore);
Thanks,
My question is, I can see a ExampleUserStore.cs class but the ManageController.cs is currently not using this, it is using the UserManager type to perform actions on the user.
UserManager
gets IUserStore
implementation from the IoC container (see this line). So ManageController
should use ExampleUserStore
through UserManager
as you see. Have you checked it is actually get called?
In order to create my own Stored Procedure to create the user (CreateAsync) where will I add this call / how do I adapt this to work without EF. Can I still use the UserManager with manual Stored Procedure calls?
ExampleUserStore
is the place, the class that inherits from IUserStore
should perform DB logic. Here is the implementation as it is done with EF. So if you use bare ADO.NET you can place your call to the procedure there.
Hope it helps!