小编Ale*_*bak的帖子

当我使用下划线符号时,属性 JsonProperty 在 .NET Core 3.1 中工作不正确

我有以下 JSON 用于补丁请求:

{
    "idfa": "28A427FE-770B-4FA3-AA8E-123",
    "idfv": "11B3343C-ECBB-4CC8123B5BA-DDD9CA5768FD",
    "app_build_number": 1,
    "app_version": "1.0.0",
    "screen_height": 820,
    "screen_width": 300,
    "locale": "ru",
    "app_id": "com.hello",
    "app_platform": "iOS",
    "manufacturer": "Apple",
    "model": "iPhone10,6",
    "os_version": "12.3.1",
    "sdk_version": "0.3"
}
Run Code Online (Sandbox Code Playgroud)

以及以下用于映射的模型:

    public class CustomerChangeViewModel
    {
        [JsonProperty("idfa")]
        [Required(ErrorMessage = "Required idfa")]
        public string Idfa { get; set; }

        [JsonProperty("idfv")]
        [Required(ErrorMessage = "Required idfv")]
        public string Idfv { get; set; }

        [Required(ErrorMessage = "Required app_build_number")]
        [JsonProperty("app_build_number")]
        public string AppBuildNumber { get; set; }

        [JsonProperty("app_version")]
        [Required(ErrorMessage = "Required app_version")]
        public string AppVersion …
Run Code Online (Sandbox Code Playgroud)

c# json .net-core-3.1 asp.net-core-3.1

10
推荐指数
2
解决办法
7320
查看次数

如何从搜索和索引中排除文件夹(JetBrains IDE)?

问题是关于 Rider 的,但我希望这个设置对于所有 Jet Brain 的 Ides 都是相似的。

我有几个带有jscss捆绑包的文件夹。例如,文件夹位于wwwroot/buildjs和中wwwroot/buildcss

问题是,当我按Ctrl + Shift + F在解决方案中查找某些内容时,或者(更糟糕)当我尝试借助重构工具(右键单击 -> 重构 -> 重命名)重命名某些内容时,Rider 也尝试在捆绑包中重命名!它很慢,而且我不需要它!有人可以告诉我如何排除这个文件夹吗?

我记得很早我可以借助右键单击文件夹 - >工具(不确定但也许) - >从索引中排除来完成此操作。但现在我看不到这个菜单项。

jetbrains-ide rider

9
推荐指数
1
解决办法
5393
查看次数

Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException

我有以下例外

Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException:HTTP/2 连接错误(PROTOCOL_ERROR):无效的 HTTP/2 连接序言。

我将描述我的条件。我有一个非常简单的 grpc .Net Core项目,我想要制作HTTP 端点

这是 Startup.cs

public class Startup
{
    // This method gets called by the runtime. Use this method to add services to the container.
    // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc(options => options.EnableEndpointRouting = false);
        services.AddGrpc();

        services.AddHttpClient<IAnalyticApiAsker, AnalyticApiAsker>();

        // db context
        services.AddSingleton<IApplicationMongoContext, ApplicationMongoContext>();

        // repos
        services.AddTransient<IWorkspacesRepo, WorkspaceRepo>();
        services.AddTransient<IApplicationRepo, ApplicationRepo>();
    }

    // This method gets called by the runtime. …
Run Code Online (Sandbox Code Playgroud)

c# kestrel-http-server

6
推荐指数
1
解决办法
2668
查看次数

找不到模块:错误:无法解析“flag-icon-css”

我将在我的 laravel 项目中安装此管理面板https://coreui.io/(免费版本)。它包含一个具有以下依赖项的 package.json 文件:

    "dependencies": {
    "@coreui/coreui": "^2.1.5",
    "@coreui/coreui-plugin-chartjs-custom-tooltips": "1.2.0",
    "@coreui/icons": "0.3.0",
    "bootstrap": "^4.2.1",
    "chart.js": "2.7.3",
    "core-js": "^2.6.1",
    "flag-icon-css": "^3.2.1",
    "font-awesome": "4.7.0",
    "jquery": "3.3.1",
    "pace-progress": "1.0.2",
    "perfect-scrollbar": "^1.4.0",
    "popper.js": "^1.14.6",
    "simple-line-icons": "2.4.1"
  },
Run Code Online (Sandbox Code Playgroud)

因此,我将把这些依赖项放入我的 package.json 中并运行 npm installnpm run dev。我的项目的packaje.json是

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot …
Run Code Online (Sandbox Code Playgroud)

npm laravel laravel-mix core-ui

5
推荐指数
1
解决办法
9452
查看次数

骑士没有看到NetCore 3.0

我以前使用过VS CODE。但是现在我想尝试JetBrains Rider。目前,我只有NetCore 3.0。但是在我拥有2.2之前。我删除了旧的NetCore并安装了新的NetCore。我正在尝试创建新项目。但是Rider没有看到NetCore 3.0。

错误

我没有看到更改NetCore SDK的功能。我的操作系统是Linux Mint18。我只有一个NetCore版本。而且是3.0。

错误

为什么会这样呢?

rider .net-core-3.0

5
推荐指数
2
解决办法
2694
查看次数

.Net Core MVC 中是否有类似 RouteConfig.cs 的东西?

我正在尝试遵循 Adam Freeman 的书“ASP .NET MVC”。本书有一章作者建议将路由放入特殊配置文件App_Start/RouteConfig.cs。它看起来不错,但我正在尝试在 .Net Core 的帮助下实现它。我没有找到路线的特殊位置,我将路线放入Startup.cs. 但它看起来非常丑陋。也许有人知道这种情况下的优雅解决方案?

这是我的代码 Startup.cs

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        // services are here ..
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            //app.UseExceptionHandler("/Home/Error");
            // The default …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core asp.net-core-routing

5
推荐指数
1
解决办法
2839
查看次数

我应该在 Yii2 中哪里设置 DI 容器?

我有一个界面。还有一个班级。该类实现接口并扩展BaseObject。它类似于业务逻辑服务。我将通过构造函数将其注入控制器中。我的目标是使用接口的依赖关系。

我正在查看文档,但我不明白,我应该在哪里编写这段代码。它是主配置的一部分吗?或者这是某种新的配置?是一个单独的文件吗?如果是 yse,Yii2 如何理解它的 DI 配置?

dependency-injection yii2

4
推荐指数
1
解决办法
2024
查看次数

在 Laravel 迁移中使用 UUID 作为默认值

我有以下迁移:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UpdateRatingGameUserAnswersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('rating_games_user_answers', function (Blueprint $table) {
            $table->uuid('answer_token')->default(DB::raw('UUID()'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('rating_games_user_answers', function (Blueprint $table) {
            $table->dropColumn('answer_token');
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

如您所见,我正在尝试将 UUID 设置为默认值。我在这里见过

但是当我运行时,php artisan migrate我看到以下内容:

在此处输入图片说明

怎么了?

laravel-migrations

3
推荐指数
1
解决办法
6016
查看次数

Spring Boot 没有看到小胡子模板

我在 Spring boot 上有非常简单的应用程序。它只是一个控制器和胡子模板。

package io.github.aleksejshherbak.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class HomeController {
    @RequestMapping("/")
    public String index() {
        return "index";
    }
}
Run Code Online (Sandbox Code Playgroud)

模板只是简单的标记

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Person keeper</title>
</head>
<body>
    <h1>Lorem ipsum dolor sit amet.</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我已经在 gradle 的帮助下安装了 mustache。我的构建文件是

plugins {
id 'java'

    // Apply the application plugin to add support for building an application
    id 'application'


    id 'org.springframework.boot' version '2.1.0.RELEASE'
    id …
Run Code Online (Sandbox Code Playgroud)

gradle mustache spring-boot

3
推荐指数
1
解决办法
1301
查看次数

FreeMarker:需要一个散列,但这已计算为一个序列

我知道同样的问题已经在这里。但不幸的是它并不能帮助我解决我的问题。我的 FreeMarker 模板中有 HashSet。我想在视图上显示哈希集的大小。为此,我有以下内容:

\n
 <td>${repo.getRepoWords().size()}</td>\n
Run Code Online (Sandbox Code Playgroud)\n

方法 getRepoWords 是:

\n
 public HashSet getRepoWords() {\n     return repoWords;\n }\n
Run Code Online (Sandbox Code Playgroud)\n

结果我看到了这个异常

\n
\n

FreeMarker 模板错误(DEBUG 模式;在生产中使用 RETHROW!):\n对于“.” 左侧操作数:需要一个散列,但其计算结果为\na序列(包装器:ftSimpleSequence):==> repo.getRepoWords() [在\n模板“repositories/detail.ftl”第 24 行第 23 列] - --- FTL\n堆栈跟踪(“~”表示与嵌套相关): - 失败于:\n${repo.getRepoWords().size()} [在模板“repositories/detail.ftl”\nat 第 24 行中,第 21 列] ~ 通过以下方式到达:#nested [在第 20 行第 1 列宏“page”中的模板\n“layouts/common.ftl”中] ~ 通过以下方式到达\n:@c.page title="\xd0\x93\ xd0\xbb\xd0\xb0\xd0\xb2\xd0\xbd\xd0\xb0\xd1\x8f\xd1\x81\xd1\x82\xd1\x80\xd0\xb0\xd0\xbd\xd0\xb8\xd1\ x86\xd0\xb0" [在模板\n"repositories/detail.ftl"第 2 行第 1 列] ---- Java 堆栈跟踪\n(对于程序员): ---- freemarker.core.NonHashException:[ ...\n异常消息已打印;请参阅上面...] at\nfreemarker.core.Dot._eval(Dot.java:48) at\nfreemarker.core.Expression.eval(Expression.java:83) at\nfreemarker.core.MethodCall._eval(MethodCall .java:58) at\nfreemarker.core.Expression.eval(Expression.java:83) at

\n
\n

我可以在 FreeMarker 模板中使用 HashSet 的 …

java freemarker

3
推荐指数
1
解决办法
8797
查看次数