0
nitinrpatel created
I want to insert data in multiple tables i.e Parent And Child table(Some Fields of Parent Table with Parent Referance) how is it possible in asp.net zero.?
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
Hi @nitinrpatel
If this code is running in an AppService method, you can follow an approach like this:
public async Task Save(){ { var master = new MasterEntity(); master.Name = "Test"; await _masterRepository.InsertAsync(master); await CurrentUnitOfwork.SaveChangesAsync(); var detail = new Detail(); detail.Name = "Detail 1"; detail.MasterId = master.Id; await _detailRepository.InsertAsync(detail); }Assuming you are using Integer as the primary key for both entities.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)