小编Dav*_*New的帖子

Azure表存储分区的个人性能

文档中,它声明Azure表存储分区的最低速度为500次/秒.

如果我的数据分区正确,那么每个分区上的并行操作是否会相互影响?

例如,如果我不得不在分区A(最多500个实体/秒)上进行昂贵的全表扫描,那么分区B上发生的任何操作的性能是否会受到影响?

存储帐户的限制为每秒5000次操作.这是否意味着我可以在它们开始影响彼此性能之前最多可以输出10个分区?

performance azure azure-storage azure-table-storage

7
推荐指数
2
解决办法
2591
查看次数

使用TypeConverter.ConvertFromString()以自定义格式解析字符串

使用时TypeConverter.ConvertFromString(),我需要在解析字符串中的数据时提供自定义格式(例如,使用DateTime:"ddMMyyyy""MMMM dd, yyyy").

TypeConverter.ConvertFromString() 有以下重载:

public object ConvertFromString(ITypeDescriptorContext context, 
                                CultureInfo culture, 
                                string text);
Run Code Online (Sandbox Code Playgroud)

我在MSDN上查了一下ITypeDescriptorContext.

ITypeDescriptorContext接口提供有关组件的上下文信息.ITypeDescriptorContext通常在设计时用于提供有关设计时容器的信息.此接口通常用于类型转换.

这听起来像我需要使用但我在任何地方都找不到任何例子.

我使用以下通用方法:

public T ParseValue<T>(string value)
{
    return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(value);
}
Run Code Online (Sandbox Code Playgroud)

调用代码示例:

DateTime date = ParseValue<DateTime>("02062001");
decimal amount = ParseValue<decimal>("1.3423");
Run Code Online (Sandbox Code Playgroud)

我希望能够将某种通用格式信息解析为此ParseValue()方法,可以使用ConvertFromString().

.net c# datetime parsing type-conversion

7
推荐指数
1
解决办法
2194
查看次数

对DropDownListFor的强类型绑定?

通常我会将数据绑定到DropDownListFora SelectList:

@Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.Orders, "OrderId", "ItemName"))
Run Code Online (Sandbox Code Playgroud)

有没有办法通过强类型lambdas而不是属性字符串来做到这一点.例如:

@Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.Orders, x => x.OrderId, x => x.ItemName))
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc html.dropdownlistfor asp.net-mvc-5

7
推荐指数
1
解决办法
4810
查看次数

域实体中的外键属性

在领域驱动设计中,领域模型应该完全不知道任何数据持久化细节。

假设 anEmployee属于 a Department。域实体可能如下所示:

public Employee
{
    public string EmployeeId { get; set; }
    public string FirstName { get; set; }
    public string LastName{ get; set; }
    public Department Department { get; set; }
    public int DepartmentId { get; set; }
}

public Department
{
    public string DepartmentId { get; set; }
    public string Name{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)

Employee.DepartmentId在域模型真正相关的或者是基础设施存储的细节?

Employee.Department在这个层面上,这种关系肯定很重要吗?

就我而言,这些实体将存储在 SQL 数据库中,数据将由实体框架检索,因此Employee.DepartmentId数据库中将存在一列。

c# domain-driven-design entity-framework poco repository-pattern

7
推荐指数
1
解决办法
2433
查看次数

Azure表存储InsertOrReplace结果

InsertOrReplace在Azure表存储上执行操作时,有没有办法确定实体是刚刚插入还是发生了替换?

TableOperation insertOperation = TableOperation.InsertOrReplace(entity);
TableResult result = table.Execute(insertOperation);
Run Code Online (Sandbox Code Playgroud)

TableResult 似乎没有表明这一点.

.net azure azure-storage azure-table-storage

7
推荐指数
1
解决办法
3659
查看次数

NuGet在构建开始之前恢复PostSharp包

我正在使用PostSharp,我的项目文件中有以下目标描述:

<Target Name="EnsurePostSharpImported" BeforeTargets="BeforeBuild" Condition="'$(PostSharp30Imported)' == ''">
  <Error Condition="!Exists('..\..\packages\PostSharp.3.1.33\tools\PostSharp.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://www.postsharp.net/links/nuget-restore." />
  <Error Condition="Exists('..\..\packages\PostSharp.3.1.33\tools\PostSharp.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://www.postsharp.net/links/nuget-restore." />
</Target>
Run Code Online (Sandbox Code Playgroud)

据我所知,当通过NuGet引用PostSharp时,这会添加到项目中,并且错误条件会检查以下内容:

  • 当PostSharp不可用时,第一个错误条件会破坏构建(即NuGet没有成功恢复它).
  • 当NuGet在最后一次构建时成功恢复PostSharp时,第二个错误条件会破坏构建,但因此未包含在项目中,因此需要进行重建.

,如果我有以下配置NuGet.Config.csproj file,是第二差错情况甚至是必要的?

NuGet.Config 文件:

<configuration>
  <packageRestore>
    <!-- Allow NuGet to …
Run Code Online (Sandbox Code Playgroud)

msbuild postsharp visual-studio nuget nuget-package

7
推荐指数
1
解决办法
5456
查看次数

指定的依赖项是Microsoft.AspNet.Mvc> = 6.0.0-beta6,但最终得到Microsoft.AspNet.Mvc 6.0.0-beta5

在VS 2015中,升级NuGet包后,我收到以下警告:

指定的依赖关系是Microsoft.AspNet.Mvc> = 6.0.0-beta6,但最终得到Microsoft.AspNet.Mvc 6.0.0-beta5.

这是什么意思?

编辑:

问题是新升级的软件包尚未恢复到我的系统.我必须通过右键单击项目并选择Restore来手动恢复软件包.

为什么他们不能恢复构建?

asp.net-core-mvc visual-studio-2015 asp.net-core

7
推荐指数
1
解决办法
1676
查看次数

C# 中的 MongoDB FilterDefinition 和 IQueryable

我有以下空间FilterDefinition

var filter = Builders<MyDocument>
                .Filter
                .Near(x => x.Point, point, 1000);
Run Code Online (Sandbox Code Playgroud)

有没有办法将它包含在IQueryable表达式中?

例如,我可能有以下 LINQ 语句。如何包含上述条件?据我所知,空间查询没有 LINQ 支持。

return Database
    .GetCollection<Places>("Places")
    .AsQueryable()
    .Where(x => x.StartDate.Date <= date)
    .Where(x => x.EndDate.Date >= date)
    .Where(x => keys.Contains(selectedKeys))
    .ToList();
Run Code Online (Sandbox Code Playgroud)

我正在使用新的 2.2.2 库。

.net mongodb mongodb-query mongodb-csharp-2.0 mongodb-.net-driver

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

MongoDB $ lookup:限制和用法

通过新的聚合管道阶段,$lookup我们现在可以执行"左外连接".

乍一看,我想立即用两个独立的集合替换我们的一个非规范化集合,并$lookup在查询时使用它们加入它们.这将解决在必要时更新大量文档的问题.现在我们只能更新一个文档.

但这肯定太好了,不是真的吗?毕竟这是一个NoSQL文档数据库!

MongoDB的首席技术官也强调了他的担忧:

我们仍然担心$ lookup可能被误用来像对待关系数据库一样对待MongoDB.但是,我们不是限制其可用性,而是帮助开发人员知道它的使用何时适当,以及何时它是反模式.在接下来的几个月中,我们将超越现有文档,为该领域提供明确,有力的指导.

有什么限制$lookup 我可以在实时,操作性地查询我们的数据时使用它们,还是应该将它们留给报告,离线情况?

mongodb mongodb-query

7
推荐指数
2
解决办法
1402
查看次数

请求遥测 - "durationMetric"?

从Blob存储解析导出的Application Insights遥测时,请求数据如下所示:

{
  "request": [
    {
      "id": "3Pc0MZMBJgQ=",
      "name": "POST Blah",
      "count": 6,
      "responseCode": 201,
      "success": true,
      "url": "https://example.com/api/blah",
      "durationMetric": {
        "value": 66359508.0,
        "count": 6.0,
        "min": 11059918.0,
        "max": 11059918.0,
        "stdDev": 0.0,
        "sampledValue": 11059918.0
      },
      ...
    }
  ],
  ...
}
Run Code Online (Sandbox Code Playgroud)

我正在寻找请求的持续时间,但我看到我被提供了一个durationMetric对象.

根据文档,request[0].durationMetric.value领域被描述为

从请求到达响应的时间.1e7 == 1s

但是,如果我使用Google Analytics查询,则该值与此字段不匹配:

在此输入图像描述

他们这样做,但是,匹配的min,maxsampledValue领域.

我应该使用哪个字段?"value": 66359508.0在上面的例子中,这个值代表什么?

azure azure-application-insights

7
推荐指数
1
解决办法
206
查看次数