public static async Task <TQueryResult> PocoQuery <TQueryResult>(this IDbConnectionCreator connectionCreator, Func <Database, Task <TQueryResult> > executeFunc) { using (var connection = connectionCreator.CreateDbConnection()) { if (connection.State != ConnectionState.Open) { await connection.OpenAsync(); } using (var db = CreateDatabase(connection)) { try { return(await executeFunc(db).ConfigureAwait(false)); } catch (SqlException ex) { connectionCreator.RaiseExecuteErrorEvent(ex); throw; } finally { connectionCreator.RaiseCommandsExecutedEvent(); } } } }
public static TQueryResult PocoQuery <TQueryResult>(this IDbConnectionCreator connectionCreator, Func <Database, TQueryResult> executeFunc) { using (var connection = connectionCreator.CreateDbConnection()) { if (connection.State != ConnectionState.Open) { connection.Open(); } using (var db = CreateDatabase(connection)) { try { return(executeFunc(db)); } catch (SqlException ex) { connectionCreator.RaiseExecuteErrorEvent(ex); throw; } finally { connectionCreator.RaiseCommandsExecutedEvent(); } } } }
private static IInternalSession GetSession(IDbConnectionCreator connectionCreator) { return new SessionV2( new VodbConnection(connectionCreator), new EntityTranslator(), new OrderedEntityMapper(), new ProxyCreator()); }
public SessionV1(IDbConnectionCreator connectionCreator) : base((IInternalSession)Engine.Get<ISession>("creator", connectionCreator)) { }
public Session(IDbConnectionCreator connectionCreator) : base(GetSession(connectionCreator)) { }