THIS PROJECT IS DISCONTINUED ON CODEPLEX.
PLEASE DOWNLOAD THE XRM TOOL BOX AND INSTALL THE ATTRIBUTE MANAGER FROM THE PLUGIN STORE FOR LATEST RELEASES.
SOURCE CODE IS LOCATED AT DLaB.Xrm.XrmToolBoxTools GITHUB’S REPOSITORY
This project is a plugin for the XrmToolBox. It's purpose is to extend and automate the creation of the
Early Bound classes.
Looking for a walk though??? Checkout the video!
Here are some of the features of the Crm Early Bound Generator:
- Generates Enums for the OptionSet. This is the same basic feature that's included as a part of the SDK.
- Sorts the OptionSets alphabetically. This is extremely helpful when comparing the OptionSets generated by two different environments, since by default, they are listed in the order they were added to the solution.
- Adds an AnonymousType Object Constructor to each early bound entity class to simplify LINQ Projections, and allow for LINQ CRM queries to return readonly properties as Entities.
- Appends the
System.Diagnostics.DebuggerNonUserCode attribute to all generated properties / methods. This keeps developers from accidentally stepping into the properties of the generated code, but still allows them to debug custom code in any partial classes.
- Generates OptionSetEnum properties for each OptionSet property of every class. This allows for early bound interactions with OptionSets, enabling intellisense, and catching bugs at compile time where the wrong OptionSetEnum is being used.
- Allows specific Entities to not be generated.
- Allows specific OptionSets to not be generated.
- Can generate a single file per Entity, rather than one big file with all Entities.
- Can generate a single file per OptionSet, rather than one big file with all OptionSets.
- Can generate a single file per Action, rather than one big file with all Actions.
- Allows for overriding the capitalization of Entity properties.
- All settings are stored in a separate xml configuration file for ease of use when sharing settings
- The tool updates the CrmSvcUtil.exe.config, and shells out to the CrmSvcUtil.exe in parallel (if creating both Entities and OptionSets), verbally announcing when it's been completed. This allows the tool to be used once to create the command
line, and then for another process to execute it automatically in the future
- Ensures that OptionSets that would normally result in invalid C# names ("1st", "#1", "OK!", etc) are converted into valid Enum Names. (Normally an underscore is added to make the name valid, unless the Option Set
contains invalid characters, then these are just removed)
- Will automatically check out any auto-generated files from TFS.
- Generates Attribute Logical Names in a Field Struct for each Entity.
- Allows for using the
Microsoft.Xrm.Client.CrmOrganizationServiceContext instead of using the OrganizationServiceContext for the base class of the ServiceContext
- Can be run directly from the command line as a part of a build process
- When the tool is run, it populates the config file for the CrmSvcUtil.exe with the settings selected, and outputs the command line used. As long as the config file and required dlls are in the same folder as the CrmSvcUtil.exe specified in the command
line, the command line can be called directly from a build. The tool would only be helpful to tweak the settings if required.
- Main Settings Section
- Include Command Line In Output
- Specifies whether to include the command line in the early bound class used to generate it
- If Create One File Per Action/Entity/Option Set is selected, the command line will only be added to a single file. This prevents all files from being updated if you switch environments for each release. The single file for each file generation
- The Service Context for Entities
- Actions.cs for Actions
- OptionSets.cs for OptionSets
- Mask Password
- Masks the password in the command line
- Use TFS to attempt to check out Files
- Will use TFS to attempt to check out the early bound classes. Only files that have actually change will get checked out.
- The Namespace has to match for Entities and OptionSets for the enum OptionSet functionality to work.
- Create All Button
- This will generate Entities, OptionSets and Actions. (Actions will only get generated if the connected version of CRM supports it)
- Entities Tab
- Enum Mappings
- Manually specifies an enum mapping for an OptionSetValue Property on an entity
- Entities To Skip
- Allows for the ability to specify Entities to not generate
- Specify Attribute Names
- Allows for the ability to specify the capitalization of an attribute on an entity
- Unmapped Properties
- Allows for the ability to specify an OptionSetValue Property of an entity that doesn't have an enum mapping
- Add Debug Non User Code
- Specifies that the DebuggerNonUserCodeAttribute should be applied to all generated properties and methods.
- Create One File Per Entity
- Specifies that each Entity will be created in it's own file
- Generate Attribute Name Consts
- Creates a Struct in each entity that contains all of the Attribute Logical Names for the Entity. Helpful if you're in a late bound situation like working with FetchXml.
- Generate AnonymousType Constructors
- Generate OptionSetEnum Properties
- Adds an additional property to each early bound entity class, for each OptionSet property it normally contains, with "Enum" post-fixed to the existing OptionSet name
- Use the Xrm Client
- Option Sets Tab
- OptionSets To Skip
- Allows for the ability to specify OptionSets to not generate
- Create One File Per Option Set
- Specifies that each OptionSet will be created in it's own file
- Actions Tab
- Actions To Skip
- Allows for the ability to specify Actions to not generate
- Create One File Per Action
- Specifies that each Action will be created in it's own file