locked
T4 Templates - DomainContextGenerator RRS feed

  • Question

  • I have created a T4 template to inject my own base class for all Entity classes.  I have ran this on a test silverlight solution, and it worked like a charm.  However, when I move the same process to my production solution, it no longer works.  Now there is a difference between the two solutions.  My wcf ria services link links to a normal class library that houses my domain services.  The .web application still exists, but it just references this class library as well.  This allows us to move the actual real work around different solutions so that we can have different install bases that are pertinent to our clients.  Is there some entry in the .web project that allows my code generator to be mef'ed in that my normal class library will not?  Both my .web and service project references my T4 project.

     

    I am utilizing Silverlight 4, with the April 2011 toolkit.

     

    Thanks in advance.

    Friday, July 22, 2011 4:36 PM

Answers

  • The T4 template is only used during compilation, it is not running on the server. Since you are using a RIA Services Class Library, I am going to guess that you are making one of the three common mistakes related to that

    1. Make sure that the server side dll of the class library is in the bin folder of the web application. This can be done by adding a reference to the class library from the web application or by manually copying the dll.
    2. Make sure the connection string from the class libraries app.config is copied to the web application's web.config.
    3. Make sure that the web application is setup to host DomainServices. The easiest way to do that is to add a DomainService to the web application and then delete it. That will setup the web.config and add the proper references.

    Everything else should follow the troubleshooting document in the RIA Services documentation.

    Thursday, July 28, 2011 8:24 AM

All replies

  • Hi,

    However, when I move the same process to my production solution, it no longer works.


    Kindky share the exect problem with more details. Is there any error messages?

    In addition ,you can use Fiddler to check the incoming or outgoing data ,then get the detailed information of this issue.

    Hope it can help you.

    Thursday, July 28, 2011 5:34 AM
  • The T4 template is only used during compilation, it is not running on the server. Since you are using a RIA Services Class Library, I am going to guess that you are making one of the three common mistakes related to that

    1. Make sure that the server side dll of the class library is in the bin folder of the web application. This can be done by adding a reference to the class library from the web application or by manually copying the dll.
    2. Make sure the connection string from the class libraries app.config is copied to the web application's web.config.
    3. Make sure that the web application is setup to host DomainServices. The easiest way to do that is to add a DomainService to the web application and then delete it. That will setup the web.config and add the proper references.

    Everything else should follow the troubleshooting document in the RIA Services documentation.

    Thursday, July 28, 2011 8:24 AM