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

回答

相關問題