小编Afs*_*bbi的帖子

如何将整个班级标记为"不确定"?

我有一个名为MyClass的测试类.MyClass有一个TestFixtureSetUp,可以加载一些初始数据.我想在加载初始数据失败时将整个类标记为不确定.就像有人通过调用Assert.Inconclusive()标记一个测试方法Inconclusive.

有什么解决方案吗?

c# nunit unit-testing

3
推荐指数
1
解决办法
527
查看次数

如何使源安全只读?

最近我们从VSS迁移到SVN.但我不想完全删除VSS,而是希望每个人都可以只读取它?可能吗?怎么样?

visual-sourcesafe

3
推荐指数
1
解决办法
1006
查看次数

自动.ToString()?

我有一个这样的方法:void m1(string str)并有一个这样的类:

public class MyClass
{
    public bool b1 { set; get; }

    //and other properties
}
Run Code Online (Sandbox Code Playgroud)

现在为什么下面的代码不会导致编译错误?

IClass2 _class2 = new Class2();
MyClass c1 = new MyClass();
_class2.m1("abcdef" + c1);
Run Code Online (Sandbox Code Playgroud)

当我调试它时,我意识到c1.ToString()已经传递给了m1.为什么会.ToString()发生这种自动?我唯一可以说的是m1已经在IClass2接口中定义并且已经实现了Class2.

.net c# interface tostring

3
推荐指数
2
解决办法
2754
查看次数

.Net Core 支持反射吗?

读了 Reflection不支持的.Net Core。是Reflection完全不支持.Net Core?或者,它会很快增加,甚至是必要的唯一事情是使用特定的namespaceextension method或库?

许多.Net Framework应用程序依赖于Reflection. 如果.Net Core长期不支持,可以使用哪种替代方案?

reflection .net-core

3
推荐指数
1
解决办法
1468
查看次数

UseCookieAuthentication和UseIdentity之间的区别?

ASP.NET CoreStartup in Configure方法中,当您配置piplelines时,您可以使用UseIdentityfrom ASP.NET Core Identity或者您可以使用UseCookieAuthentication.它们都提供基于cookie的身份验证.

我想知道他们的不同之处.在内部UseIdentity使用UseCookieAuthentication?一个是另一个的优点和缺点是什么?

谢谢你的解释.

authentication asp.net-identity asp.net-core

3
推荐指数
1
解决办法
5527
查看次数

在ASP.NET Core中添加数据库驱动的调度程序的正确位置是什么?

我添加了一个TimerStartup类的的ASP.Net Core应用。它会在某个时间段触发,并执行诸如记录示例文本的操作。我需要它能够执行数据库驱动的操作,例如将记录添加到表中。因此,我尝试AppDbContext从DI 获取信息,但它始终为null。请查看代码:

    public class Scheduler
{
    static Timer _timer;
    static bool _isStarted;
    static ILogger<Scheduler> _logger;
    const int dueTimeMin = 1;
    const int periodMin = 1;

    public static void Start(IServiceProvider serviceProvider)
    {
        if (_isStarted)
            throw new Exception("Currently is started");

        _logger = (ILogger<Scheduler>)serviceProvider.GetService(typeof(ILogger<Scheduler>));

        var autoEvent = new AutoResetEvent(false);
        var operationClass = new OperationClass(serviceProvider);
        _timer = new Timer(operationClass.DoOperation, autoEvent, dueTimeMin * 60 * 1000, periodMin * 60 * 1000);
        _isStarted = true;
        _logger.LogInformation("Scheduler started"); …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection startup asp.net-core

3
推荐指数
1
解决办法
607
查看次数

模拟无接口类

一般的模拟框架和特定的Rhino模拟只能模拟具有虚方法的接口和类吗?例如,我可以模拟以下简单类:

public class MyClass
{
    void method1()
    {
        //some code goes here
    }
}
Run Code Online (Sandbox Code Playgroud)

如果答案是真的,为什么存在这样的限制?有没有解决方法?

c# rhino-mocks mocking

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

如何使用linq-to-nhibernate查询继承的类?

假设我有课程Animal,Cat并且Dog.CatDog继承自Animal.考虑以下代码:

var query = from animal in session.Linq<Animal>()
            where 
            animal.Color == "White"
            select animal;
Run Code Online (Sandbox Code Playgroud)

如何向上述查询添加条件以查询实体类型?比如像animal.Type == typeof(Cat).

nhibernate linq-to-nhibernate

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

VSS的奇怪问题:VSS在下午5点后无效

我对Visual Source Safe有一个非常奇怪的问题.我使用VSS作为VS 2008的附加组件,在企业内部网中与其他5位同事一起使用.我的VS在大多数日子下午5点后停止工作抱怨无法连接Source Safe.我在Vista上运行VS 2008和VSS 2005,并且没有其他公司有这样的问题.

你怎么看待它的原因?VSS有任何日志吗?

visual-sourcesafe visual-studio

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

有两个Page_Load没有覆盖

我有一个名为PageBase继承自ASP.NET 的类Page.我想要做的东西PageBasePage_Load.我的应用程序中的所有页面都在其上完成了逻辑Page_Load.我正在考虑一种方式,Page_Load无论是在页面PageBase中还是Page_Load在页面中都可以运行.可能吗?

c# asp.net overriding pageload

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

SMTP可以接受具有错误发件人姓名的电子邮件

SMTPClient用来发送电子邮件到SMTP服务器.但是使用Send方法我可以指定任何错误的发件人姓名或电子邮件 我怎么能阻止这个?

c# smtp smtp-auth

0
推荐指数
1
解决办法
713
查看次数