score:0

i currently have the same cases. i think the problem is the lack of recognition, by npgsql, of string.isnullorempty.

i replaced the test with a check on empty string, always recognizing as not null the input parameter.

-- bad

        var data = from art in _ctx.set<soleo.model.dlar>()
                   from iva in _ctx.set<soleo.model.dlai>().where(k => k.ditta == art.ditta && k.cod == art.civa).defaultifempty()
                   from fam in _ctx.set<soleo.model.dlfa>().where(k => k.ditta == art.ditta && k.cod == art.fam).defaultifempty()
                   from mar in _ctx.set<soleo.model.dlma>().where(k => k.ditta == art.ditta && k.cod == art.mar).defaultifempty()
                   from udm in _ctx.set<soleo.model.dlum>().where(k => k.ditta == art.ditta && k.cod == art.um).defaultifempty()
                   where art.ditta == dlauth.config.current.ditta && art.cod.contains(sel_cod) && art.des.contains(sel_des)
                   && (string.isnullorempty(sel_fam) || string.compare(art.fam, sel_fam, true) == 0)
                   && (string.isnullorempty(sel_mar) || string.compare(art.mar, sel_mar, true) == 0)
                   && (art.dis >= sel_dis_da && art.dis <= sel_dis_a)
                   select new
                   {
                       cod = art.cod,
                       des = art.des,
                       des_udm = udm.des,
                       des_mar = mar.des,
                       des_fam = fam.des,
                       des_civa = iva.des,
                       mag1 = art.mag1,
                       mag2 = art.mag2,
                       des_dis = art.dis == 1 ? "si" : "no"
                   };

-- good:

            var data = from art in _ctx.set<soleo.model.dlar>()
                   from iva in _ctx.set<soleo.model.dlai>().where(k => k.ditta == art.ditta && k.cod == art.civa).defaultifempty()
                   from fam in _ctx.set<soleo.model.dlfa>().where(k => k.ditta == art.ditta && k.cod == art.fam).defaultifempty()
                   from mar in _ctx.set<soleo.model.dlma>().where(k => k.ditta == art.ditta && k.cod == art.mar).defaultifempty()
                   from udm in _ctx.set<soleo.model.dlum>().where(k => k.ditta == art.ditta && k.cod == art.um).defaultifempty()
                   where art.ditta == dlauth.config.current.ditta && art.cod.contains(sel_cod) && art.des.contains(sel_des)
                   && (string.compare(sel_fam, "", true) == 0 || string.compare(art.fam, sel_fam, true) == 0)
                   && (string.compare(sel_mar, "", true) == 0 || string.compare(art.mar, sel_mar, true) == 0)
                   && (art.dis >= sel_dis_da && art.dis <= sel_dis_a)
                   select new
                   {
                       cod = art.cod,
                       des = art.des,
                       des_udm = udm.des,
                       des_mar = mar.des,
                       des_fam = fam.des,
                       des_civa = iva.des,
                       mag1 = art.mag1,
                       mag2 = art.mag2,
                       des_dis = art.dis == 1 ? "si" : "no"
                   };

but i do not think this is the solution. i will report the case to npgsql.


Related Query