我有Angular 2应用程序,它与Web API对话并执行一些基本的CRUD操作.我有几个问题:
我查看了IdentityServer4,OAuth2和OpenID示例,理解起来有点过于复杂.我快速启动了每一步,它有效,但我不明白它是如何做的.
有人可以给我任何资源,我可以从哪里开始?博客,网站,书籍,分步指南.
authentication oauth-2.0 asp.net-core-1.0 asp.net-core-webapi angular
遇到了格式化的问题.
if (!DateTime.TryParseExact(dateString, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateOn))
{
return false;
}
else if (!DateTime.TryParseExact(timeString, "hh:mm tt", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeOn))
{
return false;
}
return SaveWorkshop(id, name, dateOn, timeOn, capacity, description, duration, isCancelled);
Run Code Online (Sandbox Code Playgroud)
使用Bootstrap Datetimepicker,它确实从格式化的文本框中获取字符串
dateString = 11/28/2015,timeString = 6:46 AM
但是在结果中我确实有假并且正在解析默认日期.可能是什么问题呢?
我正面临着构造函数的问题.
public abstract class ShapeDrawer implements iShapeDrawer {
protected SimpleLine line; // the line to be drawn
protected SimpleOval oval; // the oval to be drawn
protected SimpleTriangle triangle; // the triangle to be drawn
protected SimplePolygon rectangle; // the triangle to be drawn
public ShapeDrawer(SimpleLine line) {
this.line = line;
}
public ShapeDrawer(SimpleOval oval) {
this.oval = oval;
}
public ShapeDrawer(SimpleTriangle triangle) {
this.triangle = triangle;
}
public ShapeDrawer(SimplePolygon rectangle) {
this.rectangle = rectangle;
}
}
Run Code Online (Sandbox Code Playgroud)
当我试图运行时,它会转到第一个构造函数,并为每个构造函数抛出错误.
错误:不兼容的类型:SimpleOval无法转换为SimpleLine super(椭圆形); …
我有一个在构造函数中初始化List的问题.
我试图将参数分配给变量"tr",tr.getVertices()是一个List.
SimpleTriangle tr = new SimpleTriangle(tr.getVertices(), tr.getColour(), tr.getThickness(), ShapeType.TRIANGLE);
trList.add(tr);
Run Code Online (Sandbox Code Playgroud)
它高亮tr.getVertices()并说"变量tr可能尚未初始化"
其中SimpleTriangle是子类.
public SimpleTriangle(List<Point> vertices, Color colour, int thickness, ShapeType shapeType) {
super(vertices, colour, thickness, shapeType); }
Run Code Online (Sandbox Code Playgroud)
和父类有方法
public List<Point> getVertices() {
return vertices;
}
Run Code Online (Sandbox Code Playgroud)