[ Tools / Download ] Epicor LINQPad Starter Kit

Download: Epicor_10_LINQPad_Starter.linq (3.9 KB)

Intro

Have you always wanted to make use of LINQPad for BPM Prototyping, but got stuck in configuration limbo and weren’t quite sure how to reference assemblies to make use of the ErpContext? If yes, then this quick-starter guide is for you.

I am going to assume you know what LINQPad is and what benefit’s you get with the professional version and if not then visit https://www.linqpad.net/ for more information.

Screenshots

Download Starter File

Download: Epicor_10_LINQPad_Starter.linq (3.9 KB)

Credits

When Epicor 10.1.400 was released @Edge sent me his . linq files which required little to no configuration and it makes use of the web.config, reads the connection details and with it, allows you to use the ErpContext() or IceContext() - you know that fancy Db object in Method and Data Directives, yes that one. Thank’s Stephen!

Configuration

Once you download the Epicor_10_LINQPad_Starter.linq file and open it.

Press F4 it will bring up a dialog where you can point to your Server’s Assemblies. Fix the ones in RED, shown below are the typical 10.1.500.x paths for the Assembly Locations.

The Starter file includes common used Namespaces:

In the LINQPad Window point to your web.config file:

You should be all set, it was that easy. You don’t need a Connection! Remember it reads it from your web.config

Few Gotchas

  1. If you are having connection issue(s) make sure that your web.config file isn’t pointing to Database Server (local) which is usually seen when the SQL Database is on the same machine as the App Server, common in development environments. Make sure you change it to the actual server name instead.

Epicor_LINQPad_5_9

  1. One limitation is that you can’t use ttTables, the idea is that you use this with actual tables such as Db.Part and prototype, debug and analyze your query. Once you are confident that it’s all good to go - you make some minor tweaks and paste it into a BPM.

  2. When you want to use Business Objects such as Ice.Core.Session etc, make sure you add the Assembly to your references - typically you will add BO .dll’s from your Local Epicor Client Folder

  3. Can’t use LockHint, unless you probably specify an additional assembly.

  4. For Epicor 10.2 make sure you enable the commented-out line EpiProviderRegistrator.Register();

Have Fun

Overall, you can use Business Object’s, Query Syntax or Method Syntax . Prototyping in LINQPad has often saved me from various headaches in the past. If you have the Paid LINQPad Version, you get to enjoy some additional IntelliSense.

Wait Theres More Reminder

If you do use the BOs make sure you Press F4 to include the Assemblies!

14 Likes

@hasokeric, figured I’d give this a try since I’m working on a new BPM. I’m on E10.2.200.8 and I’m running into an error on the line:

EpiProviderRegistrator.Register();

InvalidOperationException: The default DbConfiguration instance was used by the Entity Framework before an attempt was made to set an instance of ‘EpiConfiguration’. The ‘EpiConfiguration’ instance must be set at application start before using any Entity Framework features or must be registered in the application’s config file. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information.

Thoughts?

Never mind; I added EntityFramework.SqlServer.dll and it worked!

Thanks!

Yes I had to get new System packages with nuget, try this starter-kit for EF6

1 Like