在过去的一周里,我一直在尝试使用以下配置配置和启动一个非常简单的项目:
Angular 2,Visual Studio 2015更新1,类型脚本配置
我在项目的根目录中有一个tsconfig.Json,内容如下:
{
"compilerOptions": {
"rootDir": "src",
"outDir": "web/js",
"target": "es5",
"module": "system",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"listFiles": true
},
"exclude": [
"wwwroot",
"node_modules"
],
"filesGlob": [
"app/**/*.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
我可以看到解决方案资源管理器中的虚拟项目,角度和所有必需的软件包都按照angular.io 5分钟教程(https://angular.io/guide/quickstart)中的说明安装.
这就是我在App.ts中的内容:
import {bootstrap, Component} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
符号'组件无法正确解析,可能位于无法访问的模块中'
相同的配置在VS Code中有效,没有任何问题.
如果你能证明我错过了什么,我将感激不尽.
谢谢.
我的asp.net核心控制器有一个简单的模型:
[HttpPost]
public async Task<DefaultResponse> AddCourse([FromBody]CourseDto dto)
{
var response = await _courseService.AddCourse(dto);
return response;
}
Run Code Online (Sandbox Code Playgroud)
我的模型是:
public class CourseDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Genre { get; set; }
public string Duration { get; set; }
public string Level { get; set; }
public string AgeRange { get; set; }
public string Notes { get; set; }
public bool Active { get; set; }
public string OrganisationCode …Run Code Online (Sandbox Code Playgroud) model-binding custom-model-binder asp.net-core-mvc asp.net-core
目前在我的代码中我有一个这样的方法:
.AddMethod(nameof(IRoleService.GetRoles))
Run Code Online (Sandbox Code Playgroud)
我想要做的是使用lambda表达式选择接口方法,然后在AddMethod中获取方法的名称.结果将是:
.AddMethod<IRoleService>(x=> x.GetRoles)
Run Code Online (Sandbox Code Playgroud)
我试过这个:
AddMethod<T>(Expression<Func<T, Action>> expression);
Run Code Online (Sandbox Code Playgroud)
但问题是一些接口方法有输入参数,我试图忽略,因为我只需要方法名称.如果你能帮助我,我将不胜感激.
亚历克斯