Using MyBase, Converting a C# Code to VB.Net

  • Thread starter Thread starter Aron29
  • Start date Start date
A

Aron29

Guest
Good Day Everyone

I'm creating a ASP.NET webapi with a VB.NET as code behind, then I'm searching some code in the net, most of the site I searched, it always in C#, so I convert it using the online Telerik C# to VB.NET Convert, but I'm encountering some problems iike this.


public class OAuthContext: IdentityDbContext<IdentityUser>
{
public AuthContext()
: base("OAuthContext", throwIfV1Schema: false)
{
}

public static OAuthContext Create()
{
return new OAuthContext();
}
}



If you convert in it will turn into this.

Public Class OAuthContext
Inherits IdentityDbContext(Of IdentityUser)

Public Sub New()
MyBase.New("OAuthContext", throwIfV1Schema:=False)
End Sub

Public Shared Function Create() As OAuthContext
Return New OAuthContext()
End Function
End Class




Now the problem is the AuthContext on this C# code has to be called on my other class

Private authContext As AuthContext
Private userManager As UserManager(Of IdentityUser)

Public Sub New()
authContext = New AuthContext()
userManager = New UserManager(Of IdentityUser)(New UserStore(Of IdentityUser)(authContext))
End Sub

I'm not a VB and C# master so I don't know what is the other way around for this code, does someone knows a another way around for this?


Thanks and Regards

Continue reading...
 
Back
Top