0
私は存在するSQL Serverデータベースを持っています。エンティティフレームワーク - 空のクラスを生成します。
ビジュアルスタジオ2013 asp.netプロジェクトに新しいado.netエンティティデータモデルを追加し、モデルコンテンツ 'データベースから生成'という名前の「DB」という名前を付けました。
エンティティフレームワーク項目がプロジェクトに正常に追加されました。 VSはすべてのテーブルに対してファイルとクラスを自動的に生成しましたが、エンティティ名は「DB」のため、コメント付きのファイルのみを作成しました。
DB.csファイルがどのように見えるか、この:例えば
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
そして、これをどのように見えるか、ファイルPerson.cs(つまり、テーブルの人を表します):
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Kupa_V1.Dal
{
using System;
using System.Collections.Generic;
public partial class Person
{
public Person()
{
this.Family = new HashSet<Family>();
this.Family1 = new HashSet<Family>();
this.Help = new HashSet<Help>();
}
public int PersonId { get; set; }
public Nullable<int> FamilyId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public System.DateTime DateOfBirth { get; set; }
public string TeudatZehut { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string Issue { get; set; }
public virtual ICollection<Family> Family { get; set; }
public virtual ICollection<Family> Family1 { get; set; }
public virtual Family Family2 { get; set; }
public virtual ICollection<Help> Help { get; set; }
public virtual Work Work { get; set; }
}
}