我正在尝试使用TFS团队构建,但找不到任何体面的启动文档/指南.有人可以给我一些关于do/dont的指示,也许是一个好指南的链接?
谢谢!
我正在使用使用表单身份验证的ASP.NET应用程序.但是,如果我关闭除表单之外的所有身份验证方法,我会得到一个
HTTP错误401.2 - 未经授权
尝试浏览任何页面时.但是,启用匿名身份验证可以修复它.是什么导致这种行为?谢谢!
我有一个项目列表,我将传递给视图.我想使用显示模板渲染每个项目.但是,有些东西是错的,因为我没有正确渲染场.这是我的主要观点(Index.cshtml):
@model IEnumerable<CustomEntity>
@{
ViewBag.Title = "Index";
}
@Html.DisplayFor(m=>m)
Run Code Online (Sandbox Code Playgroud)
这是我的显示模板:
@model CustomEntity
<div>
@Html.LabelFor(m=>m.Name):
<strong>@Model.Name</strong>
@Html.LabelFor(m=>m.Icon):
<strong>@Model.Icon</strong>
@Html.LabelFor(m=>m.TypeName):
<strong>@Model.TypeName</strong>
</div>
Run Code Online (Sandbox Code Playgroud)
页面加载,但不显示实体的值.
我有一个带有一个out参数的函数的ojbect.我想用反射的Invoke来调用这个函数.但是,我找不到一种方法来指定它是一个out参数,因为它返回null.
Class Foo
{
void Do(out string a){ a="fx call"; }
}
Foo f = new Foo();
string param = string.Empty;
f.GetType().GetMethod("Do").Invoke(f, new object[] { param });
Assert.IsTrue( ! string.IsNullOrEmpty(param));
Run Code Online (Sandbox Code Playgroud)
上面调用断言失败,因为param为Empty.如何指定传递的参数是"out"?
谢谢!
我需要使用 SMO 从 .NET 执行数据库恢复。在恢复之前,我将数据库设置为 RESTRICTED_USER WITH ROLLBACK IMMEDIATE 模式。这在测试/调试期间工作正常 - 所有用户都被删除。但是,当此代码在夜间作为自动化过程的一部分运行时,有时会出现以下异常:
Microsoft.SqlServer.Management.Common.ExecutionFailureException:执行 Transact-SQL 语句或批处理时发生异常。---> System.Data.SqlClient.SqlException: 由于数据库正在使用中,无法获得独占访问权限。RESTORE DATABASE 异常终止
这里发生了什么事?谢谢!
我们最近开始在TFS 2010自动构建中收到以下错误消息:
C:\ Builds\1\MyProject\MyProject Release\Sources\MyProject\MainLineMyProject.SharePoint.EnterpriseUI.SiteDefinition\Features\MasterPagesMyProject\MasterPagesMyProject.feature:指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名必须少于248个字符.
最初我认为这是由于Sharepoint,但是一些进一步的研究指出我在TFS方向.除了截断这个问题的路径以外的任何方式?
class Foo:
def do_work:
client = Client()
client.widgets(self.widget_id).parts().get()``
Run Code Online (Sandbox Code Playgroud)
我有上面的代码。Client() 类在另一个包中定义。我正在尝试使用模拟对其进行单元测试,如下所示:
magic_mock = MagicMock()
api_client = Client()
magic_mock.api_client.widgets().parts().get.return_value = self.generate_mock
Run Code Online (Sandbox Code Playgroud)
不幸的是,它似乎不起作用。什么是更好的方法?
我有很多 .annotate 有点复杂的 django 查询:
query = ModuleEngagement.objects.filter(course_id=course_id)\
.values('username')\
.annotate(
videos_overall=Sum(Case(When(entity_type='video', then='count'), output_field=IntegerField()))) \
.annotate(
videos_last_week=Sum(Case(When(entity_type='video', created__gt=seven_days_ago, then=1),
output_field=IntegerField()))) \
.annotate(
problems_overall=Sum(Case(When(entity_type='problem', then='count'), output_field=IntegerField()))) \
.annotate(
problems_last_week=Sum(Case(When(entity_type='problem', created__gt=seven_days_ago, then='count'),
output_field=IntegerField()))) \
.annotate(
correct_problems_overall=Sum(Case(When(entity_type='problem', event='completed', then='count'),
output_field=IntegerField()))) \
.annotate(
correct_problems_last_week=Sum(Case(When(entity_type='problem', event='completed',
created__gt=seven_days_ago, then='count'),
output_field=IntegerField()))) \
.annotate(
problems_attempts_overall=Sum(Case(When(entity_type='problem', event='attempted', then='count'),
output_field=IntegerField()))) \
.annotate(
problems_attempts_last_week=Sum(Case(When(entity_type='problem', event='attempted',
created__gt=seven_days_ago, then='count'),
output_field=IntegerField()))) \
.annotate(
forum_posts_overall=Sum(Case(When(entity_type='discussion', then='count'),
output_field=IntegerField()))) \
.annotate(
forum_posts_last_week=Sum(Case(When(entity_type='discussion', created__gt=seven_days_ago, then='count'),
output_field=IntegerField()))) \
.annotate(
date_last_active=Max('created'))
Run Code Online (Sandbox Code Playgroud)
annotate 是否接受字典作为参数,以便我可以将所有注释移动到其中?如果是这样,语法是什么?
我正在尝试使用以下代码确定是否已过去一年:
bool HasYearPassed
{
get
{
var inception = InceptionDate.Value; // DateTime Value from UI
var expiration = ExpirationDate.Value; // DateTime Value from UI
TimeSpan difference = expiration - inception;
return difference.Days > 365;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在某些情况下,我得到的答案不正确.具体来说,如果启动日期是2014年1月1日,到期日期是2015年1月1日,则difference.Days返回365,但测试失败,尽管确实已经过了一年.有什么改进逻辑的建议吗?
谢谢!
.net ×2
asp.net ×1
asp.net-mvc ×1
datetime ×1
django ×1
django-orm ×1
iis-7 ×1
mocking ×1
python ×1
python-mock ×1
reflection ×1
team-build ×1
tfs ×1
tfs2010 ×1
tfsbuild ×1
timespan ×1