c# - Merge 2 POCO into 1 Class and execute CRUD -


i using petapoco orm , want combine 2 poco 1 class , execute crud operations class.

right got this:

*table person has fk address_id.*

public class person {     public personpoco person { get; set; }     public addresspoco address { get; set; }      public person(string sql)     {         person = db.singleordefault<personpoco>(sql);         address = db.singleordefault<personpoco>("select * addresses id = @0, personpoco.address_id");     }      public void save()     {         var addressid = db.save(address); // returns inserted id          person.address_id = addressid;         db.save(person);     } } 

this working fine far. gets annoying , repetive doing every needed combination.

especially saving pain, since have map inserted id dependent object.

are there better ways achieve this?

petapoco designed fast , lightweight, so, won't find kind of complex mapping linq-to-sql or ef have in it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -