none
How to pregenerated view when the POCO entities are in another library? RRS feed

  • Question

  • I have I common library, where I have my POCO entities and one interface for the repository. I have other library, that use EF 4.4, have the edmx and I use the T4 template to  create the myContext.Context.tt and myContext.tt.

    I delete the myContext.tt because I will use the POCO entities that are in the common library.

    Well, this works fine, I can use the POCO entities in different implementations of the repository.

    Now I would like to pregenerated the views in my library that use EF 4.4, not the common library, but the implementation of my repository. To do that, I use two tools.

    First of them is the Microsoft EF Power tools beta 3. In this case, I can create, from the edmx, the myComntext.Views.tt fiel that has the precompiled views, but when I set a breakpoint in the getViewAt method, this method is not execute, so the pregenerated views are not used.

    I also try to use the T4 template by Pawel Kadluczka, but the result is the same.

    So I would like to if it is possible to use pregenerated views when the POCO entities are in an external library. And if this is possible, how to do it.

    I am using model first solution (I generate my edmx model from the database).

    Thanks.


    Tuesday, June 18, 2013 3:28 PM

Answers

  • Hi ComptonAlvaro,

    How did you use the POCO entities in the other library? Did you just add the reference or are there some other steps?

    I have also tested to create POCO classes in other library and then generate views from the .edmx file. But I found the GetViewAt method is executed.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thursday, June 20, 2013 9:00 AM
    Moderator

All replies

  • Hi ComptonAlvaro,

    How did you use the POCO entities in the other library? Did you just add the reference or are there some other steps?

    I have also tested to create POCO classes in other library and then generate views from the .edmx file. But I found the GetViewAt method is executed.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thursday, June 20, 2013 9:00 AM
    Moderator
  • Well, I have in my solution one Project that is the commonRepository Project. In this Project I have my POCO entities and has the iterface that all the libraries need to implement.

    I have other Project in my solution. This library has a reference to the commonRepositry Project. This Project has the edmx model and the myContext.Context.tt created with the T4 template DbContext. I can use perfectly the POCO entities in the common library, but when I try to pregenerated the views in this library that implements the interface, the pregenerated views are not used.

    How could you explain a bit more step by step how do you pregenerated the views? some template or extension?

    Thanks.

    Thursday, June 20, 2013 10:21 AM