VS 2013 da yangi (GetPerson) konsol loyihasini hosil qiling.
Loyihaga yangi ADO.NET Entity Data Model elementini qo’shing.
Muloqot oynasidan Code First from database qismini tanlang.
DBga yangi ulanishni (New Connection) hosil qiling.
Ushbu muloqot oynasida App.config konfiguratsiya faylida ishlatiladigan ulanish satri nomini PersonContext ga o’zgartiring.
AdventureWorks2012 DBdagi Person.Person jadvalini tanlang.
Finish tugmasini bosing.
Natijada quyidagi Person klassi generatsiya qilinadi:
namespace GetPerson
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("Person.Person")]
public partial class Person
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int BusinessEntityID { get; set; }
[Required]
[StringLength(2)]
public string PersonType { get; set; }
public bool NameStyle { get; set; }
[StringLength(8)]
public string Title { get; set; }
[Required]
[StringLength(50)]
public string FirstName { get; set; }
[StringLength(50)]
public string MiddleName { get; set; }
[Required]
[StringLength(50)]
public string LastName { get; set; }
[StringLength(10)]
public string Suffix { get; set; }
public int EmailPromotion { get; set; }
[Column(TypeName = "xml")]
public string AdditionalContactInfo { get; set; }
[Column(TypeName = "xml")]
public string Demographics { get; set; }
public Guid rowguid { get; set; }
public DateTime ModifiedDate { get; set; }
}
}
|