Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Unanswered

How to retrievedata with Linq using early bounds in plugin

Posted on by 5

Don't know how to retrieve data with linq using early bound in plug-in 

can anyone please suggest me how to do that. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Crm.Sdk.Messages;
using System.Net;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using CrmEarlyBound;

namespace RetrieveWithLinqUsingPlugin
{
public class Plugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

OrganizationServiceContext orgSvcContext = new OrganizationServiceContext(service);
{

//Account account = new Account();
//var retrieve= from a in orgSvcContext.CreateQuery("account")
// where ((string)a["name"]).Contains("India")
// select a;
//foreach (var a in retrieve)
//{
// Console.WriteLine("Name: "+ a["name"]);
//}

var retrieveData= from a in orgSvcContext.AccountSet
}
}
}
}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans