MKValidator.Mohammad_Mukammil
1.0.3
See the version list below for details.
dotnet add package MKValidator.Mohammad_Mukammil --version 1.0.3
NuGet\Install-Package MKValidator.Mohammad_Mukammil -Version 1.0.3
<PackageReference Include="MKValidator.Mohammad_Mukammil" Version="1.0.3" />
paket add MKValidator.Mohammad_Mukammil --version 1.0.3
#r "nuget: MKValidator.Mohammad_Mukammil, 1.0.3"
// Install MKValidator.Mohammad_Mukammil as a Cake Addin #addin nuget:?package=MKValidator.Mohammad_Mukammil&version=1.0.3 // Install MKValidator.Mohammad_Mukammil as a Cake Tool #tool nuget:?package=MKValidator.Mohammad_Mukammil&version=1.0.3
MKTSSolutions.MKValidator
Please follow below steps to use MKValidator
Step 1. Create New Project in visual studio Step 2. Install Nuget Package by using below command in your nuget package manager console
PM>Install-Package MKValidator.Mohammad_Mukammil
Step 3. Now setup is completed and you can use the library like this
Eg. // you can get error message in string variable
string errorMessage; //used for message
using MKValidator; using System;
namespace MkValidatorTest { class MkValidatorTest { static void Main(string[] args) { Employee employee = new Employee(); employee.Name = "Mohd Mukammil"; employee.Email = "abc@gmail.com"; employee.Age = 25; employee.MobileNumber = "7895869325"; employee.Remarks = "Test Remarks";
string errorMessage = string.Empty;
#region Method 1 To Get Error Message
try
{
if(MKValidator.MKValidator.Check<Employee>(employee))
{
// Do your work here
}
}
catch(Exception ex)
{
errorMessage = ex.Message; // Getting Error Message From MKValidator
}
#endregion
#region Method 2 To Get Error Message
if (MKValidator.MKValidator.Check<Employee>(employee,ref errorMessage))
{
// Do your work here
}
Console.WriteLine("Error Message = " + errorMessage);
#endregion
}
public class Employee
{
public int Id { get; set; }
[ValidateRequired] // Required Validation Applied
public string Name { get; set; }
[ValidateEmail] // Email Validation Applied
public string Email { get; set; }
[ValidateRequired] // Required Validation Applied
[ValidateRegularExpression(@"\d||\d.\d")] // Regular Expression Validation Applied
public string Salary { get; set; }
[ValidateLength(11)] // Length Validation Applied
public string MobileNumber { get; set; }
public string Remarks { get; set; }
[ValidateNumber] // Number Validation Applied
[ValidateRange(1, 150)] // Number Range Validation Applied
public int Age { get; set; }
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0 | 2,838 | 11/26/2017 |
2.0.0-beta | 823 | 11/20/2017 |
1.0.3 | 1,126 | 11/2/2017 |
1.0.1 | 847 | 10/29/2017 |
1.0.0 | 1,205 | 10/23/2017 |
Now one can get error message via ref string variable.