Example #1
0
 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));
         }
     }
 }
Example #2
0
 public static void Execute(bool beginTransation, Action <IDataExecuteContext> action)
 {
     using (var ds = BeginSession(null, beginTransation)) {
         using (var helper = new DataExecuteContext(ds, beginTransation)) {
             action(helper);
         }
     }
 }
Example #3
0
 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();
             }
         }
     }
 }