This is the easy part...
Create a new 4.0 console application named whatever, and add it to your solution.
Add a reference to your LINQTest provider to the new project.
Add and application configuration to your project and add these settings. Remember, your provider uses a configuration supplied from your consuming application..
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
<add key="AxBCUser" value="BusConUser"/>
<add key="AxBCPassword" value="BusConPassword!"/>
<add key="AxBCDomain" value="yourdomain"/>
<add key="AxConfigFile" value="C:\YourAXConfig.axc"/>
<add key="AxApplicationName" value="YourAppName"/>
</appSettings>
</configuration>
Add this code to the Program.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LINQTest;
using System.Data.SqlClient;
namespace TestBench
{
class Program
{
static void Main(string[] args)
{
int val = 0;
DAXDataAccessLayer con = new DAXDataAccessLayer();
DynamicsAX db = new DynamicsAX(con);
IQueryable<AddressState> query = (from e in db.AddressState
where e.RECID > val
select e);
Console.WriteLine("Query:\n{0}\n", query);
var list = query.ToList();
foreach (var item in list)
{
Console.WriteLine("{0},{1}", item.NAME, item.STATEID);
}
Console.ReadLine();
}
}
}
Run it and viola, a fully IQueryable interface to Dynamics AX via the business connector.
Hope you had fun. I am currently working on SELECT, ORDER, JOIN, and UPDATE capability..
Stay tuned... and hope you learned something and had as much fun as I had figuring it out.
Harold
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment