.NET Standard did not support 'System.ComponentModel.DataAnnotations', and 'System.Type.Properties', how to keep compatible with it ?
System.ComponentModel.DataAnnotations Namespace. The System.ComponentModel.DataAnnotations namespace provides attribute classes that are used to define metadata for ASP.NET MVC and ASP.NET data controls. Extends the metadata information for a class by adding attributes and property information that is defined in an associated class.
The System.ComponentModel.DataAnnotations namespace provides attribute classes that are used to define metadata for ASP.NET MVC and ASP.NET data controls. Extends the metadata information for a class by adding attributes and property information that is defined in an associated class.
The namespace System.ComponentModel.DataAnnotations, has a group of classes, attributes and methods, to make validations in our.NET applications. In the Microsoft world, there are technologies such as WPF, Silverlight, ASP MVC, Entity Framework, etc., which make automatic validation with class and exclusive attributes.
Step 1: Data Anotation is in the namespace System.ComponentModel.DataAnnotations, so this must be added as a reference to your application. Step 2: Create an Interface, all model class on which we want to perform Validation, all the classes inherit from this interface. .... .... ....
The types from the System.ComponentModel.DataAnnotations
namespace are in the System.ComponentModel.Annotations
package, which is not installed by default in a .Net Standard library, so you need to install it manually to use it there.
If you mean Type.GetProperties()
, then that method exists as an extension method in .Net Core and in .Net Standard. In a .Net Standard library, you will need to install the System.Reflection.TypeExtensions
package. In both a .Net Core application and a .Net Standard library, you will need to add using System.Reflection;
to your source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With