小编twi*_*ams的帖子

在ASP.NET Core RC2中重写URL

如何在ASP.NET Core RC2中完成URL重写?当我刷新页面时,从RC1迁移到RC2打破了我的Angular 2路由.

我之前在我的wwwroot中的web.config中使用了这样的规则.使用RC2我甚至不确定我是否应该在我的wwwroot中有一个web.config,或者我应该在我的项目的基础上有一个.

这是我的基础web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="true" stdoutLogEnabled="true" />
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

这是我的wwwroot web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!--Redirect selected traffic to index -->
        <rule name="Index Rule" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_URI}" matchType="Pattern" pattern="^/api/" negate="true" />
            <add input="{REQUEST_URI}" matchType="Pattern" pattern="^/account/" negate="true" />
          </conditions>
          <action type="Rewrite" url="/index.html" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

当我刷新一个有角度的2路线时,我 …

url-rewriting asp.net-core

10
推荐指数
1
解决办法
3647
查看次数

gulp-typescript在保存时发出错误,但随后的保存很好

我不确定这是一个gulp问题,打字稿问题还是Angular 2问题.

我目前正在使用Angular 2 Beta 6.

这是我的打字稿gulp任务.

var tsProject = p.typescript.createProject("tsconfig.json");

gulp.task("client-scripts", function () {
    return gulp.src(paths.client.root + "**/*.ts")
        .pipe(p.cached("client-scripts"))
        .pipe(p.typescript(tsProject))
        .pipe(gulp.dest(paths.webroot.root));
});
Run Code Online (Sandbox Code Playgroud)

这是我的tsconfig文件.

{
  "compilerOptions": {
    "noImplicitAny": true,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": false,
    "target": "es5",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我的Angular 2引导程序文件,其中包含角度测试版6所需的一些类型.我认为这是问题可能发生的一个领域.

///<reference path="../../node_modules/angular2/typings/browser.d.ts"/>
///<reference path="../../typings/shim.d.ts"/>

import { bootstrap } from "angular2/platform/browser";
import { ROUTER_PROVIDERS } from "angular2/router";
import { HTTP_PROVIDERS } from "angular2/http";
import { DataPlatformComponent } …
Run Code Online (Sandbox Code Playgroud)

typescript gulp angular

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

单个数据库调用从 EF Core 中的多个表中提取数据

下面的代码当前打开了一个到我的数据库的连接 3 次,以拉出每个对象。

有没有更好的方法来制作查询,以便数据库只被命中一次并拉回我正在寻找的所有对象?

var metadataResult = new MetadataViewModel
            {
                Milestones = goalsContext.Milestones.Select(m => new MilestoneViewModel
                {
                    Id = m.Id,
                    Name = m.Name,
                    Year = m.Year,
                    Date = m.Date
                }),
                Aggregates = goalsContext.Aggregates.Select(a => new AggregateViewModel
                {
                    Id = a.Id,
                    Name = a.Name
                }),
                Metrics = goalsContext.Metrics.Select(m => new MetricViewModel
                {
                    Id = m.Id,
                    Name = m.Name,
                    Description = m.Description
                })
            };
Run Code Online (Sandbox Code Playgroud)

entity-framework entity-framework-core

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