Linq and epicor 9

(Louis Fequet) #1


Is it possible to use linq in an Epicor 9.05.702 customisation?

(Louis Fequet) #2

It’s seems that I can’t add the System.Core.dll through Reference assembly manager. Am I missing something?

(Louis Fequet) #3

Got it.

I moved the System.Core.dll in the Epicor Client folder.

(Louis Fequet) #4

Although, i keep getting this error : ‘System.Windows.Forms.Control.ControlCollection’ does not contain a definition for ‘OfType’
IEnumerable<EpiShape> test = grpBoxRessSelect.Controls.OfType<EpiShape>();

I’ve added System.Core.dll and using System.Linq

Any ideas?

(Dan Edwards) #5

My guess is the error has to do with the version of the System.Windows.Form used more than a Linq issue. You can use, code like that listed below, to recursively get all controls that are part of a form regardless of parent.

private void FindControls(Control ctrlContainer) 
	foreach (Control ctrl in ctrlContainer.Controls) 
		if (ctrl.GetType() == typeof(EpiTextBox))  // Specifiy type of Control
			// Do whatever with Text Box

		if (ctrl.HasChildren) 

FindControls(this.UD01Form) // Change to form you wish to recursively find controls for

(Louis Fequet) #6

Hi Dan,

Thanks for your response. I finally used the Find method on Controls because my search was about the control name for particular reasons.

Regardind Linq, even a simple list can’t be used:

orderedList = list.OrderBy(o => o).ToList();

Error: CS1525 - line 354 (1784) - Invalid expression term ‘>’
Error: CS1026 - line 354 (1784) - ) expected
Error: CS1002 - line 354 (1784) - ; expected
Error: CS1525 - line 354 (1784) - Invalid expression term ‘)’

Anyway, I simply want to thank you your time and for the piece of code you’ve provided.