문제

I have a problem, i just need to pass a value from template file to another (T4), for example i need to pass controllername from Controller.cs.t4 to list.cs.t4 (MVC 5.1), or if there is away to get controller name into list.cs.t4

Thanks

도움이 되었습니까?

해결책

Share a static class Helper ? , rethink your design to be more "stateless" ?

To share "running-code" please check this answer "Can I execute code from another file in a T4 .tt template for code generation?"

If you want to share code with your regular C# project, that is possible, but you need to build the shared code into an assembly you can reference. It's not possible to just use the <#@ include #> directive to pull in a .cs file directly as the directives don't nest inside control or class feature blocks. 'Quoted From the above Answer'

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