none
T4 template for View Generation RRS feed

  • Question

  • I have added a T4 template for View Generation to my project as described in this article

    If I put a break point in the generated class constructor or the GetViewAt function, it does no get hit, is this normal?

    How can I be sure this generated code is actually used by EF.

     


    • Edited by voilbak Monday, October 3, 2011 11:49 AM
    Monday, October 3, 2011 11:47 AM

Answers

  • My poco's and my edmx where in different projects. If I move my T4 template for View Generation from my edmx project to my poco project, everything works fine and the breakpoint gets hit.

    kind regards

    • Marked as answer by voilbak Saturday, October 8, 2011 8:08 PM
    Saturday, October 8, 2011 8:08 PM

All replies

  • Hi voilback,

    I set the break point at the GetViewAt method, I wrote a function to retrieve the first entity from EDMX.

    var test= context.Employees.First();

    Press F11-->step by step---->Alert Window will be shown(autmatic step-over)---->Choose Yes--->it will run to GetView method.

    Have a nice day.

     


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 5, 2011 1:58 AM
    Moderator
  • Also tried this, breakpoint doesn't get hit.

    what's the trigger for this code to be executedt, is it the attribute EntityViewGenerationAttribute

    Please help?

    Thursday, October 6, 2011 2:43 PM
  • hi,

    Yes! I'm sure it was executed when I press F5. I just set the break point at the "GetViewAt" method.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, October 7, 2011 6:50 AM
    Moderator
  • When I Include my edmx into a test console project, and use the default code generation strategy, everything works fine and my breakpoint gets hit.

     

    But when i use the same edmx in my original project, which uses for example POCO's it does not get hit. I wonder how i can ever find what's the cause and cure for this.

    Friday, October 7, 2011 9:52 PM
  • My poco's and my edmx where in different projects. If I move my T4 template for View Generation from my edmx project to my poco project, everything works fine and the breakpoint gets hit.

    kind regards

    • Marked as answer by voilbak Saturday, October 8, 2011 8:08 PM
    Saturday, October 8, 2011 8:08 PM