0

当我在MVC3中创建模型时,是否有任何解决方法在属性上设置自定义值(如以下示例[MyCustomValue()])以及如何以编程方式获取该值?如何在MVC3中的模型的属性上设置自定义值?

Imports System.ComponentModel 
Imports System.ComponentModel.DataAnnotations 
Imports System.Web.Mvc 
Imports System.Collections.Generic 

Public Class MyModel 

    Public Property MyModelId As Integer 

    <StringLength(20), MyCustomValue(True)> 
    Public Property Name As String 

[...] 
+1

的http:// MSDN .microsoft.com/en-us/library/sw480ze8(v = vs.110).aspx?cs-save-lang = 1&cs-lang = vb#code-snippet-1 –

+0

不错的提示! tnx @AntP – Max

回答

相关问题