gpt4 book ai didi

vb.net - ASP.NET 身份代码从 C# 转换为 VB.NET

转载 作者:行者123 更新时间:2023-12-05 05:22:33 25 4
gpt4 key购买 nike

请引用下面的代码片段,

   public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and role manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create); .................

上面的代码片段可以在我的默认 MVC 模板中的 Startup.cs 文件中找到。

我想将项目转换为 VB.NET。但我无法将以上四行转换为 VB.NET

请让我知道转换以上行的合适语法是什么。

最佳答案

使用AddressOf

app.CreatePerOwinContext(AddressOf ApplicationDbContext.Create)
app.CreatePerOwinContext(Of ApplicationUserManager)(AddressOf ApplicationUserManager.Create)
app.CreatePerOwinContext(Of ApplicationRoleManager)(AddressOf ApplicationRoleManager.Create)
app.CreatePerOwinContext(Of ApplicationSignInManager)(AddressOf ApplicationSignInManager.Create)

关于vb.net - ASP.NET 身份代码从 C# 转换为 VB.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40220589/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com