I think you need something like this

    public List&lt;T&gt; Get(System.Linq.Expressions.Expression&lt;Func&lt;T, bool&gt;&gt; filter = null)
    {
        IQueryable&lt;T&gt; query = dbSet.AsQueryable();
        if (filter != null)
        {
            query = query.Where(filter);
        }
        return query.ToList();
    }


Follow this link

generic helper to get ObjectResult<T> that will match any given EntityObject
    @Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    SmsMessage[] msgs = null;

    if (bundle != null) {
        Object[] pdus = (Object[]) bundle.get("pdus");
        msgs = new SmsMessage[pdus.length];

        for (int i = 0; i &lt; msgs.length; i++) {
            msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
            if (msgs[i].getOriginatingAddress().equals(
                    SmsModuleActivity.number))
                deleteMessage(context, msgs[i]);
        }
    }
}

private void deleteMessage(Context context, SmsMessage msg) {
    Uri deleteUri = Uri.parse("content://sms/inbox/");
    Cursor c = context.getContentResolver().query(deleteUri, null, null,
            null, null);
    while (c.moveToNext()) {
        try {
            String pid = c.getString(0);
            String uri = "content://sms/inbox/" + pid;
            ContentValues values = new ContentValues();
            values.put("read", true);
            context.getContentResolver().update(Uri.parse(uri), values,
                    null, null);
            context.getContentResolver().delete(Uri.parse(uri), null, null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


New incoming sms not removed. When I get sms from this number it delete only old sms from this sender, but no new message. I need delete new incoming message from specific number (see source code.)
