2

I'm currently using CodeFluent Entities and I want to generate a text-based report that prints some statistics about my current model.

The Template Producer meets all my expectations but I've some problems while using Linq extension methods :

[%@ namespace name="System.Linq" %]

[%= Producer.Project.Entities.Where(entity => entity.IsLightWeight).Count() %]

I have the following error message : The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missin an assembly reference?).

Is there a way I can refer other assemblies from a CodeFluent Entities template file ?

Community
  • 1
  • 1

2 Answers2

1

You can add template directive at the beginning of the template file in order to add assemblies and namespaces.

[%@template language="CSharp" providerOptions="CompilerVersion=v3.5" %]
[%@ Reference name="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" %]
[%@ namespace name="System.Linq" %]
meziantou
  • 20,589
  • 7
  • 64
  • 83
0

Add reference in your .cs file

using System.Linq;
Nilesh Gajare
  • 6,302
  • 3
  • 42
  • 73