suggestions map domain (orm) objects information send objects (dto)


the tide component i am operative creates palace activerecord yield orm (object relational mapping) between domain objects database. good good during many times indeed works well!



the problem comes palace activerecords support asynchronous execution, well, some-more personally sessionscope manages event objects go to. enlarged story short, bad things happens!



we therefore looking proceed simply modify (think automagically) domain objects (who know db exists care) dto vigilant (who know zero db caring sessions, mapping attributes thing orm).



does anyone have suggestions doing this. start i am looking simple one mapping object. domain vigilant person mapped contend persondto. i wish manually given waste.



obviously tact comes mind, nonetheless i am anticipating improved trust floating around site "cooler" suggested.



oh, i am operative c#, orm objects conspicuous before mapped palace activerecord.






example code:



by @ajmastrean's ask i have an instance i have (badly) mocked together. instance capture form, constraint form controller, domain objects, activerecord repository an async helper. rather large (3mb) since i enclosed activerecored dll's indispensable running. need emanate database called activerecordasync your internal accessory only change .config file.



basic sum example:



the constraint form



the constraint form anxiety contoller



private companycapturecontroller mycontroller { get; set; } 


on initialise form calls mycontroller.load()
private vacant initform ()
{
mycontroller = new companycapturecontroller(this);
mycontroller.load();
}
this relapse behind slight called loadcomplete()



public vacant loadcompleted (company loadcompany)
{
_context.post(delegate
{
currentitem = loadcompany;
bindingsource.datasource = currentitem;
bindingsource.resetcurrentitem();
//toto: line thow difference given event range used fetch loadcompany gone.
grdemployees.datasource = loadcompany.employees;
}, null);
}
}


this where "bad stuff" occurs, given controlling child list association set idle load.



the controller



the controller bucket slight called form, following calls asyc supporter asynchronously loadcompany slight following relapse constraint form's loadcomplete method.



public vacant bucket ()
{
new asynclistload<company>().beginload(loadcompany, form.loadcompleted);
}


the loadcompany() slight simply creates repository know company.



public association loadcompany()
{
relapse activerecordrepository<company>.find(setup.company.identifier);
}


the rest instance rather generic, twin domain classes get bottom class, setup record instert information repository yield activerecordmediator abilities.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?