在应用Scrum时,产品待办事项是用户案例。我在TFS上创建了一个示例故事,如下所示:
作为用户,我可以注册系统。
然后,我创建了以下任务:
有些任务是前端(HTML,CSS等),有些是后端(发送电子邮件等)。
public interface IQueryHandler<in TQuery, out TResult>
where TQuery : IQuery<TResult>
{
TResult Handle(TQuery query);
}
Run Code Online (Sandbox Code Playgroud)
这是一个查询处理程序接口,需要一个参数来执行查询。
public class PlaceByIdHandler : IQueryHandler<PlaceById, PlaceModel>
{
...........
public PlaceModel Execute(PlaceById query)
{
return repository.Query<PlaceModel>("select * from places where id="+ query.id);
}
}
Run Code Online (Sandbox Code Playgroud)
但有些查询不需要参数。例如获取所有地点:
public class PlaceAllHandler : IQueryHandler<PlaceAll, PlaceModel>
{
..........
public PlaceModel Execute(PlaceAll query)
{
return return repository.Query<PlaceModel>("select * from places");
}
}
Run Code Online (Sandbox Code Playgroud)
但现在 PlaceAll 是一个没有 Member 的类。
public class PlaceAll{}
Run Code Online (Sandbox Code Playgroud)
这是真正的方法吗?有订单吗?
我有一个字符串数组,并希望使用LINQ将其转换为double数组.我不想使用foreach循环.
var texts = new List<string>
{"-87.98 65", "-86.98 75", "-97.98 78", "-81.98 65"}
Run Code Online (Sandbox Code Playgroud)
至:
var numerics = new List<IEnumerable<double>>
{
new List<double>{-87.98, 65},
new List<double>{86.98, 75},
new List<double>{-97.98 78},
new List<double>{-81.98 65}
}
Run Code Online (Sandbox Code Playgroud)
LINQ有什么简短的方法吗?
我想通过 sql 查询获取统计信息。我的表是这样的:
ID MATERIAL CREATEDATE DEPARTMENT
1 M1 10.10.1980 D1
2 M2 11.02.1970 D2
2 M3 18.04.1971 D3
.....................
.....................
.....................
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得这样的数据计数范围
DEPARTMENT AGE<10 10<AGE<20 20<AGE
D1 24 123 324
D2 24 123 324
Run Code Online (Sandbox Code Playgroud) 我有一个从 http 加载数据的图表组件:
export class BarChartComponent implements OnInit {
dataObservable: Observable<any>;
constructor(private httpClient: HttpClient){
this.dataObservable = this.httpClient.get<any[]>(response.dataEndpoint);
}
ngOnInit() {
this.dataObservable.subscribe((data: any) => {
//draw chart
})
}
search() {
this.dataObservable = this.httpClient.get<any[]>(`${this.dataEndpoint}/category=123`);
this.dataObservable.subscribe((data: any) => {
//draw chart
})
}
}
Run Code Online (Sandbox Code Playgroud)
我设置了dataObservable构造函数并订阅了ngOnInit()函数。但我使用查询字符串更改了 URL,并再次收到请求。于是我又订阅了new。但我已经订阅了ngOnInit()。
我可以重新加载 observable 而无需再次订阅吗?
我正在使用Arcgis Javascript API.API基于dojo工具包构建.所以我需要在API中使用dojo功能.我正在准备dojo配置文件如下.
var pathRegex = new RegExp("/\/[^\/]+$/");
var locationPath = location.pathname.replace(pathRegex, '');
var dojoConfig = {
async: true,
parseOnLoad: false,
baseUrl:"js/",
packages: [
{
name: "application",
location: locationPath + '/js/application'
}]
};
Run Code Online (Sandbox Code Playgroud)
我创建了一个bootstrapper.js,如下所示.
require(["application/main", "dojo/domReady!"], function (application) {
console.log("bootstrapper is running");
application.Run();
})
Run Code Online (Sandbox Code Playgroud)
而index.html文件是这样的.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Arcgis Javacsript API Samples</title>
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css">
</head>
<body class="claro">
<div id="map"></div>
<script src="//js.arcgis.com/3.6/"></script>
<script src="js/application/djConfig.js"></script>
<script src="js/application/bootstrapper.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的应用程序托管在IIS上,并且有像这样的地址:htp://domain/Demo/Sample1/index.html
当我运行应用程序时,此代码给出如下错误.
"NetworkError:404 Not Found - http://js.arcgis.com/3.6/js/dojo/application/main.js …
到目前为止,我已经使用了Entity Framework和SQL Server数据库.所以我可以将我的表名称表示为类名和属性名称,如下所示.
class Product{
public string Id { get; set;}
public string Name { get; set;}
}
Run Code Online (Sandbox Code Playgroud)
表名和列名与我的班级相同.
但现在我将使用Postgresql数据库工作.表名和列名是这样的.
products,product_categories(小写)product_id, product_name, category_id,......所以我不想使用这样的类名:
class products {
public string product_id { get; set; }
public string product_name { get; set; }
public string category_id { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这看起来像一个丑陋的命名约定.我该如何解决这个问题?
我有不同类型参数的动作.
public class MyController : ApiController
{
[HttpPost]
public UpdateFeatureResponse UpdateFeature(UpdateFeatureResuest reqResuest)
{
return new UpdateFeatureResponse { IsSuccess = true };
}
[HttpPost]
public DeleteFeatureResponse DeleteFeature(DeleteFeatureRequest request)
{
return new DeleteFeatureResponse{ IsSuccess = true };
}
}
Run Code Online (Sandbox Code Playgroud)
我的请求类型是这样的:
public class UpdateFeatureResuest
{
public int Id { get; set; }
public string Feature { get; set; }
}
public class UpdateFeatureResponse
{
public bool IsSuccess { get; set; }
}
public class DeleteFeatureRequest
{
public int Id { get; set; } …Run Code Online (Sandbox Code Playgroud) 我在我的identityserver应用程序中创建了一个api资源:
new ApiResource
{
Name = "socialnetwork",
Scopes =
{
new Scope()
{
Name = "socialnetwork.read_contents",
DisplayName = "Read"
},
new Scope
{
Name = "socialnetwork.share_content",
DisplayName = "Write"
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我如何在我的socialnetwork api控制器中使用这个范围.
public class SocialController : Controller
{
[HttpGet]
public async Task<IActionResult> GetCotntents(){
}
[HttpPost]
public async Task<IActionResult> ShareCotntents(string content){
}
}
Run Code Online (Sandbox Code Playgroud)
socialnetwork.read_contents范围,则可以访问GetCotntents()方法.socialnetwork.share_content范围,则可以访问ShareCotntents()方法.实际上范围的目的是这个吗?我该如何使用它?
我是 OpenXML c# 的新手,我想从 excel 文件中读取行。但我需要按名称阅读excel表。这是我读取第一张纸的示例代码:
using (var spreadSheet = SpreadsheetDocument.Open(path, true))
{
WorkbookPart workbookPart = spreadSheet.WorkbookPart;
WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
SheetData sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
foreach (Row r in sheetData.Elements<Row>())
{
foreach (Cell c in r.Elements<Cell>())
{
if (c.DataType != null && c.DataType == CellValues.SharedString)
{
// reading cells
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我如何通过工作表名称找到并读取单元格。
c# ×6
.net ×1
agile ×1
angular ×1
asp.net-mvc ×1
cqrs ×1
dojo ×1
excel ×1
javascript ×1
linq ×1
openxml ×1
openxml-sdk ×1
postgresql ×1
rxjs ×1
scrum ×1
sql ×1