Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Data Annotation Validation from .net Standard Class Library

$
0
0

Hi Team,

I have class library in .net Standard 2.0 with EntityFrameworkCore. I have created class with Custom Data Annotation as below:

Model Definition

public class UserLogin : NotificationObject
{
[DbRequired]
[Display(Name = "USER NAME", Prompt = "ENTER USER NAME")]
public string User_Name
{
get { return GetValue(() => User_Name); }
set { SetValue(() => User_Name, value); }
}

    [Display(Name = "PASSWORD", Prompt = "ENTER PASSWORD")]
    [DataType(DataType.Password)]
    [DbRequired]
    public string User_Password
    {
        get { return GetValue(() => User_Password); }
        set { SetValue(() => User_Password, value); }
    }
}

**But this data annotation validation is working in Asp.Net Core and WPF. But we want to use the same in Xamarin.Forms for Android & iOS and UWP. Is it possible or any workaround? As I heard that in .net Standard you need write once and can be reuse in all other environment **


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>