Changes in Sublogix Version 1.2

I’ve pushed version 1.2 of Sublogix to NuGet. There’s some changes in how the custom entity templates are created by default. In previous versions of Sublogix, the custom entity templates used the display names for tables and fields in SalesLogix to create classes and properties. This caused several problems such as:

Localized/International versions of SalesLogix had many characters in the display names that would cause isseues when used as table & field names.

If a display name was changed (user’s see these display names when building groups and several other places) then when the entities were generated again your properties would be different and you’d have to change code that references the old property name.

The new change in version 1.2 of Sublogix now uses the table & field names by default for the entity class names and properties. There is an option to use the display names still if you’d like in the entity template settings file. This means that the built in entites in Sublogix will be using table name and field names for the entities rather than the display names as it used previously. So, if you’re upgrading Sublogix in an existing project you’ll need to do a one-time remapping of code from the old property names to the new ones where the display name was different than the field or table name. But at least you’ll now be able to avoid changing code if someone needs to change a display name somewhere. If you’d like to avoid this you can either just not upgrade to 1.2 of Sublogix or upgrade and change the template settings file to continue to use display names for the entity names and properties.

Some Background on Entity Templates

Sublogix uses Visual Studio T4 templates to generate code for the entities based on what the schema includes in your SalesLogix database. Out of the box, Sublogix includes an enity model based on the standard SalesLogix blank database. You can drop the templates into Visual Studio, modify the connection properties in the template settings file and then Visual Studio will transform the templates into an actual C# code file by connecting to your SalesLogix database and analyzing the tables & fields and then emitting the code for those tables & fields. When you use Sublogix, if all you need to do is work with the standard out of the box SalesLogix tables, you don’t need to use the templates at all – you can just use the entity model built into Sublogix. If you need to work with anything custom, such as custom fields to out of the box tables or completely custom tables, then you can use the entity templates to generate your entity model based on your database schema.

Field and table names will still be pascal cased and dashes and underscores removed for the entity names & properties. MYFIELDNAME will end up being Myfieldname and MY_FIELD_NAME will end up being MyFieldName. There’s a few other special circumstances, such as if the field name is the same as the table name, for those the value “Name” will be appended to the end. For example, the ACCOUNT field on the ACCOUNT table will end up being AccountName (you can’t have a property the same name as the class it’s in). Also, it looks for ending “ID” and makes that “Id” and the built in CREATEDATE/USER & MODIFYDATE/USER will be properly cased. Using the field & tables names don’t end up as pretty, but it will be easier to work with going forward and less prone to errors and code changes.

Getting Sublogix

Sublogix continues to be distributed via the NuGet packaging system only. To date it’s had 240 downloads from NuGet since they started tracking downloads, that number doesn’t include any downloads before they started keeping track of that which was several versions into NuGet. How is this working? Would a non-NuGet option be worthwhile? If I were to make the Sublogix source code publically available on github would anyone be interested in contributing? There is much work to be done in the expression trees for using Linq expressions for the Repository.Find overload (it is currently pretty limited in the kinds of expressisons it can handle). Thoughts? Feedback?

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

For the GetSecCode function, it basically will just return the value from USERSECURITY.DEFAULTSECCODEID for the current user. If the current user does not have a value in that field it will return SYST00000001.