He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix.I have specific Visual Studio Templates for specific projects.
There is however one thing that I do a lot, and that is create classes that post specific XML to SYSPRO via WCF or Web Services. Obviously I have been creating a reusable and generic set of classes that allow me to post to SYSPRO using the various business object XMLs. This is a work in progress as there are many business objects. The review below will outline a very basic CodeSmith Generator template. Obviously this is just scratching the surface and I hope to expand on this post in later articles. This might look daunting to a first time user, but believe me once you have rolled your own you will realize how easy this process is. This just gives CodeSmith Generator Studio some basic info regarding this template. CodeSmith Generator templates are really just plain text files containing one of three different content types. So I paste this into the template editor below the CodeTemplate Directive. CodeSmith Generator looks for content wrapped between tokens. The content between these tokens is treated as expressions which CodeSmith Generator evaluates at runtime. Codesmith Review Code Between TheAs you can see, the code between the tokens is simply just C. In the example below, the result of DateTime.Now.ToLongDateString() replaces the expression. Lets assume that we want to define the Author and class description of the code file. For this purpose CodeSmith Generator allows for the creation of property directives. For each bit of information you want to collect from the user, you need to add a property directive. You can see that I have added four property directives below the CodeTemplate Directive. You can also see the description of the specific property directive in the little pop-up next to the property. You can even specify default values for a property directive by doing the following. Fill in the required information for the property directives we defined earlier. I can now generate many different classes based on this single template by simply changing my property values as needed.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |