Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Using Linq in code snippets?

I'm working on creating an external assembly for an OnBeforeDelete event and I got an odd error so I decided to try using a code snippet instead.

 

It's valid LINQ, but it will not compile in app architect.

 

ERROR - C:\Users\\AppData\Roaming\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.d6de2ce9-c9c9-4f2b-9b47-2d7965468064.codesnippet.cs(44,13):The type or namespace name 'IEnumerable' could not be found (are you missing a using directive or an assembly reference?)

ERROR - C:\Users\\AppData\Roaming\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.d6de2ce9-c9c9-4f2b-9b47-2d7965468064.codesnippet.cs(44,71):'System.Collections.Generic.ICollection<Sage.Entity.Interfaces.IOpportunity>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.ICollection<Sage.Entity.Interfaces.IOpportunity>' could be found (are you missing a using directive or an assembly reference?)

 

My usings:

using System;

using Sage.Entity.Interfaces;

using Sage.Form.Interfaces;

using NHibernate;

using Sage.SalesLogix.API;

using System.Linq;

Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: Using Linq in code snippets?

And here is the odd error I got, which is preventing me from using an assembly in the first place:

The dynamic method step, OnBeforeDelete from type EntityEventValidators.ContactDeletion, EntityEventValidators, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has an invalid number of parameters.

There's a step prior to it in PreExecute called ValidateBeforeContactDeletion, but I can't disable it.
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Using Linq in code snippets?

I beleive you need .NET 4.0 for LINQ.  The snippet library targets .NET 3.5.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.