代码第一列,类型为char(36) [英] Code first columns with type char(36)
本文介绍了代码第一列,类型为char(36)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我当前的注释创建了一个列 nvarchar(36)
[StringLength(36)]
public string UserIdentifier {get ;组;我想要一列 char(36)
这是可能的吗?解决方案如果你想保留数据注释,那么只需使用:
[StringLength(36)]
[Column(TypeName =char)]
public string UserIdentifier {get;组; }
So I have a UserProfile model class as part of SimpleMembership. In it I need to store a legacy identifier that exists in another DB of type char(36)
. I'd love to change this to something more sensible like a uniqueIdentifier but that's out of scope for today's activities.
My current annotation creates a column nvarchar(36)
[StringLength(36)]
public string UserIdentifier{ get; set; }
I'd like a column of char(36)
instead. Is this possible?
解决方案 If you want to keep with Data Annotations, then just simply use:
[StringLength( 36 )]
[Column( TypeName = "char" )]
public string UserIdentifier{ get; set; }
这篇关于代码第一列,类型为char(36)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文