Get Unique Name on LiveLinq ClientView

Posted by: ejbang on 5 December 2017, 5:28 am EST

    • Post Options:
    • Link

    Posted 5 December 2017, 5:28 am EST

    Hi,

    For example, I have the following table.

    table BookMaster{

    ID int PrimaryKey,

    BookName varchar(50),

    Addr varchar(50)

    }

    I can use the following SQL if I want to have a Unique BookName.

    select distinct BookName from BookMaster;

    I would like to know how to get a unique BookName when using ClientViewSource as below.

    EntityClientCache ClientCache = EntityClientCache.GetDefault(typeof(Bookentities));

    EntityClientScope _scope = ClientCache.CreateScope();

    ClientViewSource cvs = new ClientViewSource

    {

    BaseView = _scope.GetItems(),

    PageSize = 500,

    VirtualMode = VirtualModeKind.Unmanaged

    };

    Regards,

    Richard

  • Posted 6 December 2017, 2:30 am EST

    Hi,

    You can try with Select() and Distinct() methods as below:

    List<string> distincName = collectionOfBookMaster.Select(t => t.BookName).Distinct().ToList();
    

    Hope, it will solve your issue.

    If this does not solve your issue then please share a sample application with us so that we can assist you accordingly.

    Thanks,

    Singh

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels