Integration Your Way - (800) 235-7250
RSSBus ADO.NET Provider for MSCRM
Questions / Feedback? Creating An Entity Model

Creating An Entity Model

Step 1: Before We Begin

Launch Visual Studio and open your RSSBus ADO.NET Provider for MSCRM project. If you do not yet have a project, go ahead and create one now.

Step 2: Add a New Item To Your Project

In the Visual Studio Solution Explorer, right-click on your project, select "Add", and then select "New Item..."

Step 3: Create an ADO.NET Entity Data Model

In the "Add New Item" dialog that pops up, select "ADO.NET Entity Data Model" and name it an appropriate title like "MSCRMEntityDataModel.edmx".

Step 4: Follow the Entity Data Model Wizard

Visual Studio now presents you with a wizard. Select "Generate from database" in the first pane. In the second wizard pane, you will need to select a data connection. Go ahead and select the data provider connection you intend to use with your project. Alternatively, you can create a new connection in this pane.

The wizard also asks whether to include sensitive data (meaning passwords) in the connection string. Select the option appropriate to your needs. Note that opting to exclude sensitive data means password fields will not be copied to the generated config file with the rest of the connection string properties.

Note: this step may take several minutes as Visual Studio retrieves table schemas from MSCRM. To learn about optimizing this process, see Caching Metadata.

After Visual Studio retrieves the necessary information from the live data source, it presents a listing of database objects for you to choose to include in your project.

Step 5: Perform LINQ Commands in Your Code

You are now ready to start using LINQ in your code. Be sure to declare using System.Linq in your file.
MSCRMEntities ents = new MSCRMEntities();
var LeadsQuery = from Leads in ents.Leads
                   orderby Leads.FullName
                   select Leads;

foreach(var result in LeadsQuery) {
  Console.WriteLine("{0} {1} ", result.Id, result.FullName);
}


 
Copyright © 2013 RSSBus Inc.
[x] close

Questions / Feedback?


Name:
Email:
Feedback:
Send Feedback