entity framework 4 - EF CTP4 when to call context.SaveChanges -
i'm trying replicate many of practices use nhibernate in ef ctp4.
currently have generic repository interface (ctp4 makes quite easy dbcontext.set).
we passing in context , using structuremap scope per httprequest.
with nhibernate pass in isession (again created using structuremap) use actionfilter (unitofwork) commit transaction @ end of request.
do have equivalent transactions in ef ctp4? if not, should use same filter call context.savechanges() or inside repository.
on side note, what's easiest way of testing see whether entity new or not. nh have luxury of calling isession.saveorupdate. note entities use guid identifier. perhaps check default(guid)?
thanks.
i know late answer have figured out guess useful people searching. rob conery has great post on using actionfilter , ef create transactions per request scope.
oh , yes create updateinsert() method on generic repository test default(guid).
Comments
Post a Comment