简体   繁体   中英

How cani write Linq Query for getting Record over multipul times

Here I create one class FatClass :

 public class Ems_UserFat_Tab
 {
    public string Hr_Email { get; set; }

    public string BuHead_Email { get; set; }

My table is

Id   Email            RoleId  
1    abc@gmail.com     2             
2    lmn@gmail.com     3  

Linq Query as

var x = from n in db.EMS_USER_MASTER
        where n.ROLE_ID == 2 || n.ROLE_ID==3
        select new Ems_UserFat_Tab
        {
            Hr_Email = n.EMAIL,
            BuHead_Email=n.EMAIL
        };

Here how can I differentiate ROLE_ID=2 email and ROLE_ID=3 email in this query

 public void OnNext()
 {
     var x = list.Where(ro => ro.roleID = 2 && ro.roleID = 3)
                 .Select(ro => new CacheObject
                     {
                         Hr_Email = ro.EMAIL,
                         BuHead_Email=ro.EMAIL
                     });
 }

You have to store those values in Cache or to evoke them from DB ,which will be your object like in the example new CacheObject. Try to do it like this and debug it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM