C# 无法在.net core 1.0中使用数据批注
就像早期的beta版(dnx)一样,我正在尝试将代码移植到.net core 1.0 rtm,代码在以下单元上进行回复,其中包含ValidationAttribute类型和其他内容:C# 无法在.net core 1.0中使用数据批注,c#,visual-studio-2015,data-annotations,.net-core,C#,Visual Studio 2015,Data Annotations,.net Core,就像早期的beta版(dnx)一样,我正在尝试将代码移植到.net core 1.0 rtm,代码在以下单元上进行回复,其中包含ValidationAttribute类型和其他内容: using System.ComponentModel.DataAnnotations; namespace Hl7.Fhir.Introspection { [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultip
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.AttributeUsageAttribute
。它适用于.NET标准1.0
及更高版本
编辑:
很抱歉你问的是
ValidationAttribute
,不是AttributeUsage
,我的错。反向软件包指向,一些早期测试日建议将单元名称更改为System.ComponentModel.Annotations,但这不起作用。您尝试过吗?哦,这是预发布的位,但不是dotnet-RC2级位Hooops。。。我的错:)应该是你要找的人谢谢。节省了我很多时间。