문제

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 ?

도움이 되었습니까?

해결책

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" %]

다른 팁

Add reference in your .cs file

using System.Linq;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top