private static object GetRelacao(this IAbstractDataContext context, Type type, RelacaoAttribute relacao, bool inRelacao, TipoDatabase tipoDatabase) { if (relacao == null) { return(null); } var campos = RelacaoCampos.GetRelacaoCampos(relacao.Campos); var wheres = new List <string>(); foreach (var campo in campos) { var value = relacao.OwnerObj.GetInstancePropOrField(campo.AtributoRel); wheres.Add($"{campo.Atributo} = {tipoDatabase.GetValueStr(value)}"); } if (type is IList) { return(context.GetLista(type, string.Join(" and ", wheres), inRelacao)); } else if (type is object) { return(context.GetObjeto(type, string.Join(" and ", wheres))); } return(null); }
//-- lista public static IList <TObject> GetLista <TObject>(this IAbstractDataContext context, object filtro = null, bool relacao = true, int qtde = -1, int pagina = 0) { var listaDeCampoTipo = new[] { CampoTipo.Key, CampoTipo.Req, CampoTipo.Nul }; var where = context.GetComando() .ComObjeto(filtro) .ComTipoCampo(listaDeCampoTipo) .GetWhereObj(); return(context.GetLista(typeof(TObject), where, relacao, qtde, pagina) as IList <TObject>); }
internal object ExecuteList(string where) { return(_dataContext.GetLista(typeof(TInstance), where)); }