public QueryContext <T> GetQueryContext(T item) { ISqlBuilder <T> builder = new InsertSqlBuilder <T>(item); QueryDirector <T> director = new QueryDirector <T>(builder); return(director.GetDataContext()); }
public List <EventCustomer> Search(SearchRequestDTO input, int from, int size) { List <QueryContainer> container = new QueryDirector().CreateQuery(input); ISearchRequest request = new SearchRequest <EventCustomer>() { Query = new BoolQuery() { Must = container }, From = from, Size = size }; var result = client.Value.Search <EventCustomer>(request).Documents.ToList(); return(result); }
public void ExcuteInsertCommand <B>(B aEntity, string con) where B : EntityBase, new() { aEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now); SqlConnection l_Connection = new SqlConnection(con); SqlCommand l_Command = new SqlCommand(); l_Command.Connection = l_Connection; var l_InsertQuery = new InsertSqlBuilder <B>(aEntity); QueryDirector <B> l_Construct = new QueryDirector <B>(l_InsertQuery); var l_Context = l_Construct.GetDataContext(); l_Command.CommandTimeout = 0; l_Command.CommandText = l_Context.mSQL; foreach (var l_SQLParameters in l_Context.mSQLParameters) { l_Command.Parameters.Add(l_SQLParameters); } try { l_Connection.Open(); l_Command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { l_Connection.Close(); } }
public void ExcuteUpdateCommand <B>(B aEntity, string con) where B : EntityBase, new() { SqlConnection l_Connection = new SqlConnection(con); SqlCommand l_Command = new SqlCommand(); l_Command.Connection = l_Connection; var l_QueryBuilder = new UpdateSQLBuilder <B>(aEntity); QueryDirector <B> l_Construct = new QueryDirector <B>(l_QueryBuilder); var l_Context = l_Construct.GetDataContext(); l_Command.CommandText = l_Context.mSQL; foreach (var l_SQLParameters in l_Context.mSQLParameters) { l_Command.Parameters.Add(l_SQLParameters); } try { l_Connection.Open(); l_Command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { l_Connection.Close(); } }