C
C#ā€¢9mo ago
killmlana

IDE complaining that interface async methods are not implemented.

public interface INHibernateHelper
{
Task SetUsername(User user, string? username, ISession? session = null);
//...
}

public class NHibernateHelper : INHibernateHelper
{
public async Task SetUsername(User user, string? username, ISession? session = null)
{
//...
}
//...
}
public interface INHibernateHelper
{
Task SetUsername(User user, string? username, ISession? session = null);
//...
}

public class NHibernateHelper : INHibernateHelper
{
public async Task SetUsername(User user, string? username, ISession? session = null)
{
//...
}
//...
}
Not sure where the issue is.
15 Replies
Angius
Angiusā€¢9mo ago
That seems fine What is the exact error?
killmlana
killmlanaOPā€¢9mo ago
Interface member 'Task BlogAPI.Contracts.INhibernateHelper.SetUsername(User, string?, ISession?)' is not implemented
Interface member 'Task BlogAPI.Contracts.INhibernateHelper.SetUsername(User, string?, ISession?)' is not implemented
Angius
Angiusā€¢9mo ago
Huh, try auto-implementing it maybe? I'd remove the default value from the interface too, maybe that's an issue
killmlana
killmlanaOPā€¢9mo ago
yeah i tried, it removes the async removing the default value didn't help, and auto implementation changed it to
public Task SetUsername(User user, string? username, ISession? session = null)
{
//...
}
public Task SetUsername(User user, string? username, ISession? session = null)
{
//...
}
Angius
Angiusā€¢9mo ago
If you removed the default value, then how did autoimplementation add it?
killmlana
killmlanaOPā€¢9mo ago
i mean i tried removing the default value first then saw no improvement then i auto implemented it
Angius
Angiusā€¢9mo ago
Huh What version of .NET?
killmlana
killmlanaOPā€¢9mo ago
okay found the issue bruh i accidentally used Microsoft.AspNetCore.Http.ISession instead of Nhibernate's while setting the datatypes of the parameters in the interface
Angius
Angiusā€¢9mo ago
Because I see no complaints on .NET 8
No description
Angius
Angiusā€¢9mo ago
Ah, yeah, that would do it lol
killmlana
killmlanaOPā€¢9mo ago
so annoying šŸ˜­ took me a while
Angius
Angiusā€¢9mo ago
Why NHibernate, btw?
killmlana
killmlanaOPā€¢9mo ago
just started webdev and some guy on stackoverflow recommended it 8 years ago now i am integrating it with asp.net identity cuz of all the features i am missing shouldve just used entity framework šŸ˜­
Angius
Angiusā€¢9mo ago
Yes, you should have lol Good luck ig
killmlana
killmlanaOPā€¢9mo ago
yeah it's supposed to be a learning experience anyways, thank you
Want results from more Discord servers?
Add your server