LINQTOSITECORE CODE GENERATORABOUTThis tool is a quickest way to generate a C# class based on your Sitecore item templates. Browse Sitecore Item Templates directly from your Project in Visual Studio, select any, Generate the code. Done! I recommend to use this tool with a LinqToSitecore library together.
HOWOTO:1. Create any template in a Sitecore:
2. Right-click your project in the Visual Studio and select a menu item "LinqToSitecore: Import Templates" 3. A LinqToSitecore Window will popup! You would probaly get this alert message: 4. Click ok and setup your connection to a local copy of Sitecore instance on your PC. 5. Click Save. If everything is good you should see a content of your local Sitecore instance 6. Now - navigate to yourtemplate. You could click any item in the tree in left side and get its tempalte structure in the right panel. Aparently you could go to any item from content and click it to load its template. Or go to the templates folder directly: 7. Here you only need to press a button "Generate"! 8. However, you are free to adjust your class. a. You could change Class Name b. You could change a Class namespace c. You could Define differnet Property Names d. You could change property types 7.1 Remember to check "generate system fields" checkbox in order to get Siteocre Item, Id, Path, ParentId etc. (System Fields) in your code and Linq Queries! 7.2. Remember to adjust your project namespaces for future classes 8. Press Save and your class will be generated! 9. That is it, folks! :) |