using System.ComponentModel.DataAnnotations; public class User { [Key] public int Id { get; set; } public string Name { get; set; } public string Email { get; set; } public string Password { get; set; } }
public class Product { [Key] public int Id {get; set;} public string Name { get; set; } public double Price { get; set; } public string Description { get; set; } }In this example, we define a product entity that has an integer id, a name, a price, and a description. Overall, the System Entity Has package is a very useful tool in C# for representing and working with different types of entities in software applications.