由於我已經有我的LINQ to SQL數據訪問解決方案的類,如果我想將它們遷移到EFCF,可能遇到什麼麻煩?由於數據庫已經存在,我不願意先調用這些代碼。要清楚的是,該應用程序尚未投入生產,因此如果EFCF清除數據,這並不是真正的損失。從LINQ到SQL到實體框架的遷移「代碼優先」
我可以參加一個如下的課程,只是在EFCF中使用它?我應該還是必須刪除數據註記屬性?
什麼需要改變,我有EntityRef和EntitySet?
[Table]
public class PlanMember {
private EntityRef<SystemUser> _caseManager;
private EntityRef<PlanMemberStatus> _status;
public PlanMember() {
this.PlanMemberView = new Views.PlanMember();
}
[Column(
IsPrimaryKey = true,
IsDbGenerated = true,
AutoSync = AutoSync.OnInsert
)]
public Int64 ID { get; set; }
[Column]
public DateTime? BirthDate { get; set; }
[Column]
public String City { get; set; }
[Column]
public String FirstName { get; set; }
[Association(ThisKey = "CaseManagerID", Storage = "_caseManager")]
public SystemUser CaseManager {
get { return (this._caseManager.Entity); }
set { this._caseManager.Entity = value; }
}
[Column]
public String CaseManagerID { get; set; }
[Column]
public Boolean IsActive { get; set; }
public Boolean IsEligible {
get { return (this.PlanMemberView.IsEligible); }
}
[Column]
public String LastName { get; set; }
[Column]
public String MedicalRecord { get; set; }
[Column]
public String MemberNumber { get; set; }
[Column(Name = "PCPFullName")]
public String PrimaryCarePhysicianFullName { get; set; }
[Association(OtherKey = "PlanMemberID")]
public Views.PlanMember PlanMemberView { get; set; }
[Column]
public Int32 PostalCode { get; set; }
[Column]
public String Sex { get; set; }
[Column]
public String State { get; set; }
[Association(ThisKey = "StatusID", Storage = "_status")]
public PlanMemberStatus Status {
get { return (this._status.Entity); }
set { this._status.Entity = value; }
}
[Column]
public Int32 StatusID { get; set; }
}
幸運的是,這個應用程序相對簡單,並且不包含許多M:N關係。你能否詳細說明爲什麼你必須允許EF可以使用空列來很好地播放?沒有XML類型,至少不在LOB區域。我也在使用存儲庫,希望在發佈之前用WCF包裝它。還爲ReSharper +1! – Yuck 2011-05-09 15:23:11
可能是我前面的錯誤 - 從過去的宿醉,但我們避免int?值,所以我們設置了一些「可空」關係作爲「foregin key ID或-1爲null」,但根本不能用EF工作,它期望FK列可以爲空。 – 2011-05-09 15:37:07