0
asp.net의 모델 바인딩 기능을 사용하여 데이터베이스의 엔터티에 대한 기본 키로 Guids를 사용하고 있습니다. 4.5 엔터티 프레임 워크 5를 사용하여 데이터베이스에 레코드를 삽입 할 때 웹 양식이 사용됩니다.EF5에서 자동으로 GUID 생성 EF5
public void onInsert([Control("ControlID")] int? countryID){
if(countryID.hasValue){
var DbEntityToInsert = new DbEntity(); //where DbEntity is the class generated by the EF
TryUpdateModel(DbEntityToInsert);
DbEntityToInsert.GuidPK = Guid.NewGuid();
if(Page.ModelState.IsValid){
using(var db = new DatabaseContext()){
db.Add(DbEntityToInsert);
db.Save();
}//using ends
}//modelstate.isvalid if ends
}//countryid.hasvalue ends
}//main method ends
같은 메신저하고 뭔가 지금은 내가 선
DbEntityToInsert.GuidPK = Guid.NewGuid();