簡體   English   中英

無法在.net core 1.0中使用數據注釋

[英]Unable to use data annotations in .net core 1.0

就像早期beta(dnx)天的這個問題一樣,我試圖將代碼移植到.net core 1.0 rtm,代碼回復下面的單元,其中包含ValidationAttribute類型和其他內容:

using System.ComponentModel.DataAnnotations;

namespace Hl7.Fhir.Introspection
{
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    public sealed class FhirElementAttribute : ValidationAttribute
    ...

如何將此類代碼移植到dotnet core 1.0 rtm?

我使用非官方的反向包搜索來搜索新的Microsoft開源包中的類。

您正在尋找System.Runtime.AttributeUsageAttributeSystem.Runtime包。 它適用於.NET Standard 1.0及更高版本。

編輯:抱歉。 你問的是ValidationAttribute ,而不是AttributeUsage ,我的不好。 反向包搜索指向System.ComponentModel.Annotations

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM