2

I am calling stored procedure to get data from database using Linq. This stored procedure is using more than one table to return result using join :

public static List<classname> GetMediaTemp()
{
var medialist = (from m in Context.sp_Temp() select new classname
                                            {
                                               str_image = m.str_image,
                                                str_image_type = m.str_image_type,
                                                str_photodrawvideo = m.str_photodrawvideo,
                                            }).ToList();
if (medialist.Count > 0)
{
   return medialist
}
}

Everything working fine but now i have to filter data in this object list like on the calling end

List<classname> photoList = GetMediaTemp();//Here i want to filter list on the basis on str_photodrawvideo column.

Problem :

How i can perform this filter ?

Thanks in Advance. For more info please let me know.


Use this before starting the long task to prevent the screen lock during the task execution. Add permission in androidmanifest

<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>

before starting the task

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
4

1 回答 1

3

你可以做如下

var objList = Context.sp_Temp().ToList();
var photoList = objList.Where(o=>o._int_previous == 1).ToList();

或者

您可以将object构建对象列表的类转换为如下

var photoList = 
   (from pht in objList 
     let x=>(sp_TempResult)pht
     where x._int_previous == 1 select pht).ToList();
于 2013-10-16T06:49:48.920 回答