1

我有一个从数据库中获取数据的项目。我对模型中的数据库字段进行了一些修改,现在出现错误

The 'XXX' property on 'YYY' could not be set to a 'Guid' value. You must set this property to a non-null value of type 'String'. 

XXX 是类的键,在模型中定义为

公共字符串 XXX {get; 放;}

我的数据库中这个字段的数据类型是唯一标识符。

mvc3 中这种数据类型的“等价性”是什么?

编辑

我尝试将 XXX 的数据类型更改为

公共指南 XXX {get; 放;}

但我得到了错误

'YYY' 上的 'UnallocatedId' 属性无法设置为 'Guid' 值。您必须将此属性设置为“字符串”类型的非空值。

4

1 回答 1

2

正如它在错误中所说,您需要使用以下Guid类型:

public Guid XXX { get; set; }
于 2012-12-07T13:37:39.480 回答