小编reg*_*EAH的帖子

检查SQL Server 2008文件流状态

我在我的一个项目中使用SQL Server 2008文件流功能,是否有办法使用查询检查文件流状态(如果已启用或未启用)?

sql sql-server filestream

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

错误单元测试webapi控制器

我正在使用AspNet Web Api Client 5.0,我正在尝试对web api控制器进行单元测试.

var encservice = new EncryptionService();
var acctservice = FakeServices.GetAccountService();
var controller = new AccountController(acctservice, encservice);
controller.Request = new HttpRequestMessage();
Run Code Online (Sandbox Code Playgroud)

当代码

controller.Request.SetConfiguration(new HttpConfiguration());
Run Code Online (Sandbox Code Playgroud)

被执行我遇到了异常

消息:无法加载文件或程序集'Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'或其中一个依赖项.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

资料来源: System.Net.Http.Formatting

Stacktrace:位于System.Net的System.Net.Http.Forttting.Medic中的System.Net.Http.Forttting.Medie中的System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters()处的System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor() .HttpConfiguration.DefaultFormatters()位于System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection路由)的System.Web.Http.HttpConfiguration..ctor()位于EMR.Test.Controller.AccountControllerTest.Should_Get()的c中:\ PremiumProjectsCollection\emr\src\EMRAzure\EMRAzure\EMR.Test\Controller\AccountControllerTest.cs:第34行

我使用的newsoft.json的版本是6.0

我的配置文件中也有一个程序集重定向

 <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
  </dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

我使用的测试运行器是MStest,VS2012

c# asp.net unit-testing json.net asp.net-web-api

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

C#计算准确的年龄

任何人都知道如何根据日期(出生日期)获得年龄

我想到这样的事情

string age = DateTime.Now.GetAccurateAge();
Run Code Online (Sandbox Code Playgroud)

输出将是20年5月20日的一些事情

c#

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

QueryOver中的Nhibernate .class等效项

以下是针对特定类型的类的HQL查询

select a from Animal a
where TYPE(a) in ('Cat', 'Dog')
and a.sex = 'Male'
order by a.name


select a from Animal a
where a.class in ('Cat', 'Dog')
and a.sex = 'Male'
order by a.name
Run Code Online (Sandbox Code Playgroud)

我想知道是否有使用QueryOver等效?

nhibernate hql nhibernate-mapping queryover

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

比较 IP 地址,如果它低于另一个

任何人都知道如何比较 2 个 ipaddress 以查看 ipaddress 是否低于另一个。

IE

bool b = CurrentIpAddress.IsLowerCompareTo(AnotherIPAddress);
Run Code Online (Sandbox Code Playgroud)

我还想同时支持 IPV4 和 IPV6。

.net c# comparison ip-address

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

如何在 DB2 中执行 SQL 字符串

如何在 DB2 中执行 SQL 字符串语句?我正在使用 IBM Data Studio。

db2

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

在 C# 中,哈希表默认是按引用传递还是按值传递?

我想知道默认情况下 Hashtable 是按引用传递还是按值传递?

c# hashtable

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

具有Html5Mode刷新页面问题的Angular-UI-Router

我有一个使用angular-ui-routerhtml5mode(true)的应用程序.在运行和路由到其他州时,一切似乎都能正常工作.

我的默认状态是在module.run()期间设置的app/calendar

但是当我在目前处于其他路线时刷新页面(比如应用程序/个人资料),它会让我回到app/calendar.

调试我注意到刷新页面后$ state.current总是空的

Object {name: "", url: "^", views: null, abstract: true}
Run Code Online (Sandbox Code Playgroud)

如果只有$ state.current有值,我可以只转换到当前状态.

有什么我想念的吗?

希望有人可以提供帮助.

我的服务器路由看起来像

app.get('/:var(/|app/calendar|app/customers|app/profile|app/settings)?', function(req, res) {
    res.sendFile('/app/main/main.html',{ root: '../Appt/public' });
});
Run Code Online (Sandbox Code Playgroud)

我总是提供相同的文件.

和我的前端状态配置

(
    function()
    {
        angular.module('Appt.Main').config(['$stateProvider','$locationProvider',function($stateProvider,$locationProvider)
        {
            $locationProvider.html5Mode(true);

            var calendar = {
                    name: 'calendar',
                    url: 'app/calendar',
                    controller: 'Appt.Main.CalendarController',
                    controllerAs: 'calendar',
                    templateUrl: '/app/main/calendar/calendar.html'
                },
                customers = {
                    name: 'customers',
                    url: 'app/customers',
                    controller : 'Appt.Main.CustomersController',
                    controllerAs : 'customers',
                    templateUrl : '/app/main/customers/customers.html'
                },
                profile = …
Run Code Online (Sandbox Code Playgroud)

html5 angularjs angular-ui-router

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