public static T Execute <T>(bool beginTransation, Func <IDataExecuteContext, T> func) { using (var ds = BeginSession(null, beginTransation)) { using (var helper = new DataExecuteContext(ds, beginTransation)) { return(func(helper)); } } }
public static void Execute(bool beginTransation, Action <IDataExecuteContext> action) { using (var ds = BeginSession(null, beginTransation)) { using (var helper = new DataExecuteContext(ds, beginTransation)) { action(helper); } } }
public static void Execute <T>(bool beginTransation, Func <T, bool> func) where T : class, ISessionDataService { using (var ds = BeginSession(null, beginTransation)) { using (var helper = new DataExecuteContext(ds, beginTransation)) { var dt = helper.GetDataService <T>(); if (func(dt) && beginTransation) { helper.Commit(); } } } }