我一直试图每行显示三列.是否可以使用flexbox?
我目前的CSS是这样的:
.mainDiv {
display: flex;
margin-left: 221px;
margin-top: 43px;
}
Run Code Online (Sandbox Code Playgroud)
此代码将所有内容放在一行中.我想添加一个约束来显示每行三个记录.
我试图使用Func与异步方法.我收到了一个错误.
无法将异步lambda表达式转换为委托类型
'Func<HttpResponseMesage>'.异步lambda表达式可能返回void,Task或者Task<T>都不能转换为'Func<HttpResponseMesage>'.
以下是我的代码:
public async Task<HttpResponseMessage> CallAsyncMethod()
{
Console.WriteLine("Calling Youtube");
HttpClient client = new HttpClient();
var response = await client.GetAsync("https://www.youtube.com/watch?v=_OBlgSz8sSM");
Console.WriteLine("Got Response from youtube");
return response;
}
static void Main(string[] args)
{
Program p = new Program();
Task<HttpResponseMessage> myTask = p.CallAsyncMethod();
Func<HttpResponseMessage> myFun =async () => await myTask;
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud) 从我的Javascript客户端应用程序向我的Identity Server应用程序发出请求时,我收到以下错误.
fail:IdentityServer4.Validation.ScopeValidator [0] 无效范围:openid
我已确保在Identity Server应用程序中添加范围.以下是我的代码.
IdentityServer应用程序(主机) Config.cs
public class Config
{
public static IEnumerable<ApiResource> GetApiResources()
{
return new List<ApiResource>
{
new ApiResource("api1","My API")
};
}
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "js",
ClientName = "javaScript Client",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RedirectUris = { "http://localhost:5003/callback.html" },
PostLogoutRedirectUris = { "http://localhost:5003/index.html" },
AllowedCorsOrigins = { "http://localhost:5003" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1"
}
}
};
}
}
Run Code Online (Sandbox Code Playgroud)
Startup.cs
public …Run Code Online (Sandbox Code Playgroud) c# oauth-2.0 openid-connect identityserver4 asp.net-core-webapi
我创建了一个全新的asp,net core应用程序.我添加了mvc nuget包但我收到以下错误.
Microsoft.AspNetCore.Mvc.Core 1.1.3
'IServiceCollection'不包含'AddMvc'的定义,并且没有扩展方法'AddMvc'可以找到接受类型'IServiceCollection'的第一个参数(你是否缺少using指令或汇编引用?)
我得到一个例外.
无法隐式转换
'System.Collections.Generic.List<IntegraPay.Domain.SObjects.Industry>'为'System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<IntegraPay.Domain.SObjects.Industry>>'
以下是我的财产和方法.
private List<WebFormFieldContent> WebFormFields { get; set; } =
new List<WebFormFieldContent>();
Task<IEnumerable<WebFormFieldContent>> IRegistrationRepository.GetWebFormFields()
{
return WebFormFields;
}
Run Code Online (Sandbox Code Playgroud) 我有一个简单的中间件,可获取请求的主体并将其存储在字符串中。它正在读取流,但问题是它不会调用我的控制器,而该控制器在我读取流并抛出错误后立即调用
需要一个非空的请求正文
。下面是我的代码。
public async Task Invoke(HttpContext httpContext)
{
var timer = Stopwatch.StartNew();
ReadBodyFromHttpContext(httpContext);
await _next(httpContext);
timer.Stop();
}
private string ReadBodyFromHttpContext(HttpContext httpContext)
{
return await new StreamReader(httpContext.Request.Body).ReadToEndAsync();
}
Run Code Online (Sandbox Code Playgroud) 我收到以下错误。
消息:Microsoft.EntityFrameworkCore.DbUpdateException:更新条目时出错。有关详细信息,请参阅内部异常。----> System.Data.SqlClient.SqlException:无效的列名“EmploymentTypeEntityEmploymentTypeID”。
奇怪的是它结合了我的实体类名称和实体属性名称。
下面是我的代码。
系统测试文件
using (var transaction = _referenceDataDbContext.Database.BeginTransaction())
{
_referenceDataDbContext.EmploymentType.AddRangeAsync(
new EmploymentTypeEntity
{
EmploymentTypeID = 1,
EmploymentType = "EmploymentType",
CategoryTypeID = 27,
SiteAddress = null,
CreatedBy = "UnitTest",
CreatedOn = DateTime.Now,
ModifiedBy = "UnitTest",
ModifiedOn = DateTime.Now,
RowVersion = new RowVersion(1),
EmploymentTypeGroups = new[]
{
new EmploymentTypeGroupEntity
{
EmploymentTypeGroupID = 11, GroupName = "Child Care", IsActive = true
}
}
}
}
);
_referenceDataDbContext.Database.ExecuteSqlCommand("SET IDENTITY_INSERT [ref].[EmploymentType] ON");
_referenceDataDbContext.SaveChanges();
}
Run Code Online (Sandbox Code Playgroud)
就业类型组.cs
public class EmploymentTypeGroupEntity
{
[Key]
public int? …Run Code Online (Sandbox Code Playgroud) 我有一个下拉列表,我想将 Jquery onchange 事件绑定到 TagHelpers 选择标记。下面是我的代码。
<select asp-for="BusinessType"
asp-items="@Model.BusinessTypeCollection">
</select>
Run Code Online (Sandbox Code Playgroud)
如何绑定标记的内联 onchange 事件。
像这样的东西。
<select asp-for="BusinessType"
asp-items="@Model.BusinessTypeCollection"
onchange ="something">
</select>
Run Code Online (Sandbox Code Playgroud) 我有一个名为 Person.proto 的简单原型文件,其中包含以下内容。我不明白我错过了什么。
syntax = "proto2";
message Person{
optional string name = 1;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用的命令是
Protoc Person.proto --csharp_out=C:\Users\Owner\.nuget\packages\google.protocolbuffers\2.4.1.555\tools Person.cs
Run Code Online (Sandbox Code Playgroud)
人物.cs
public class Person
{
}
Run Code Online (Sandbox Code Playgroud) c# ×8
asp.net-core ×1
async-await ×1
asynchronous ×1
css ×1
css3 ×1
flexbox ×1
html ×1
html5 ×1
lambda ×1
oauth-2.0 ×1
protobuf-net ×1