entity framework - what should CRUD (Insert and Update) functions return ? -


i return nothing .. return true/false show if there problems.. return int being primary key of inserted or updated.. create custom object return more information.. perhaps hold collection of validation errors or may have occurred..

so not stuck seem randomly pick different way hear best practice these common functions..

i using c#/entities/repository pattern.

it's matter of personal preference. might want distinguish between commands , queries.

so creates, updates , deletes commands , expect them return void.

reads queries , return iqueryable.

however, if routinely want use inserted object directly after inserting may want return object result of insert.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -