Tag: 身份

如何将标识属性添加到SQL Server中的现有列

在SQL Server中(在我的情况下,2005)如何使用T-SQL将标识属性添加到现有表列? 就像是: alter table tblFoo alter column bar identity(1,1)

编写unit testing在ASP.NET Web API中使用User.Identity.Name的方法

我正在使用ASP.NET Web API的unit testing编写testing用例。 现在我有一个动作,它调用了我在服务层中定义的一些方法,我已经使用了下面这行代码。 string username = User.Identity.Name; // do something with username // return something 现在我如何创build这个unit testing方法,我得到空引用exception。 编写unit testing和东西我有点新意。 我只想使用unit testing。 请帮我解决这个问题。 谢谢。

如何testing(ActiveRecord)对象相等

在Rails 3.0.3 Ruby 1.9.2 ,我试图testing两个Friend (从ActiveRecord::Baseinheritance的类)对象之间的对象相等性。 对象相同,但是testing失败: Failure/Error: Friend.new(name: 'Bob').should eql(Friend.new(name: 'Bob')) expected #<Friend id: nil, event_id: nil, name: 'Bob', created_at: nil, updated_at: nil> got #<Friend id: nil, event_id: nil, name: 'Bob', created_at: nil, updated_at: nil> (compared using eql?) 只是为了咧嘴笑,我也testing对象的身份,这不符合我的预期: Failure/Error: Friend.new(name: 'Bob').should equal(Friend.new(name: 'Bob')) expected #<Friend:2190028040> => #<Friend id: nil, event_id: nil, name: 'Bob', […]

如何重置SQL Server中的增量标识的起始值

我想有一个很好的模板来做到这一点在开发中。 如何在SQL Server中重置增量标识的起始值?

Microsoft.IdentityModel dll在哪里?

我已经安装了Windows Identity Foundation,但无法findMicrosoft.IdentityModel dll。 根据Azure动手实验室,它应该在VS2010中添加引用。 但它不在那里。 我也看了c:\ Program Files文件(x86)\ Windows身份基金会*,它不在那里(或64位程序文件文件夹)。 帮帮我!

Python:为什么(“你好”是“你好”)评价为真?

为什么在Python中"hello" is "hello" == True ? 我在这里阅读以下内容: 如果两个string文字相等,则它们被放到相同的内存位置。 一个string是一个不可变的实体。 没有伤害可以做。 那么每个Pythonstring在内存中只有一个地方? 听起来很奇怪。 这里发生了什么?

为什么“is”关键字在string中有一个点时会有不同的行为?

考虑这个代码: >>> x = "google" >>> x is "google" True >>> x = "google.com" >>> x is "google.com" False >>> 为什么这样? 为了确保以上是正确的,我刚刚在Python上testing了Python 2.5.4,2.6.5,2.7b2,Python 3.1和Linux上的Python 2.7b1。 看起来所有人都有一致性,所以这是devise。 我错过了什么吗? 我只是发现,从我的个人域名过滤脚本失败。

以编程方式获取故事板ID?

尝试查看UIViewController或UIView是否可以识别它的Storyboard ID。 所以希望: UIViewController *aViewController; NSString *storyboardID = aViewController.storyboard.id; //not an actual property 要么: NSString *storyboardID = [aViewController.storyboard valueForKey:@"storyboardId"]; //also not a working call 但没有喜悦,也找不到类似的在线解决scheme。 有谁知道这是甚至可能吗?

如何只用一个IDENTITY列插入到表中

(在试图回答这个问题的过程中提出了这个问题) 考虑以下MS-SQL表,称​​为GroupTable: 组ID ——- 1 2 3 其中GroupID是主键,是一个标识列。 如何在不使用IDENTITY_INSERT ON的情况下向表中插入新行(并因此生成新的ID)? 请注意这一点: INSERT INTO GroupTable() Values () …不会工作。 编辑:我们在这里说SQL 2005或SQL 2008。

Scope_Identity(),Identity(),@@ Identity和Ident_Current()有什么区别?

我知道Scope_Identity() , Identity() , @@Identity和Ident_Current()都可以获得标识列的值,但我很想知道它们之间的区别。 我遇到的争议的一部分是什么意思的范围适用于上述这些function? 我也喜欢使用它们的不同场景的一个简单的例子?