我有兩個表這樣 表1:動物 Country Lion Tiger State
india 4 5 Madhya Pradesh
india 10 2 Utrakhand
Russia 0 10 Primorsky krai
Russia 1 20 Khabarovsk Krai
和表2:Project_Tiger Country No
India 10
Russia 5
我有以下型號 - Person和Address。 甲Person未經Address 甲Address總是屬於Person 類可以存在: public class Person {
// properties
[ForeignKey("Address")]
public int? AddressId { get; set; }
public vir
試圖找出在使用通用存儲庫模式時如何獲取最近添加的實體的Id。一個例子會很好。 這裏的倉庫, public class Repository<T> : IRepository<T> where T : class {
protected DbContext DbContext { get; set; }
protected DbSet<T> DbSet { get; set; }
public