What started out as a wee (little) test application for me to learn and understand a bit about DotNet C# and the CA Plex ModelAPI has blown out (my obsession) into a full featured Entity Creation Utility. I am also fully aware of the differences in terminology and approach between us Plexers and DotNetters which has been really useful for my company as we have a whole host of different development skills and disciplines and I feel like I can cross communicate J
The cool thing is that my employer http://www.sasit.co.nz/ (shameless plug I know) and our clients (current and future) will benefit hugely from this development when they see just how easy it is to enter all the relevant details into a CA Plex application model and generate code for all our target databases.
If I am to be honest there is still quite a lot to finish off like:-
· Entering Non-Key fields (Next project)
· Dealing for Foreign Key Relationships/OptionalitySYS and Virtual Fields
· Advanced validations
· Error Rollback
· Schema Import
Not to mention a rethink on the GUI and the application C# architecture now that I have learnt a lot more about this environment.
· Code layout and structure
· Object design
· GUI i.e. A TreeView control or something similar etc
However, for a work in progress (WIP), another one of those TLA’s I think that it is worthy blogging about and giving some screenshots. All feedback is useful and appreciated and I believe I have finally fixed the comments section too. J
This all started in a innocent post called RTFM and I will also follow up with some addition posts around the way I went about it and the features of the ModelAPI, along with a few of the traps that I fell into along the way.
The premise of the original exercise was to be able to quickly create a standard CA Plex entity with our default inheritance, Surrogate Key field and some internal naming conventions honoured.... I am now at the stage where the utility handles Surrogate (The DotNetters call this an auto increment key) and/or Natural Keys, File to File key relations, override attributes, labels, narratives and low level field and file/view implementation naming. A far cry from the original brief and I still have a roadmap as long as my arm.
So take a look below at a few screen prints with some basic commentary of what the utility currently achieves for me and future posts will show you the finished utility (Hopefully).
Overview
A simple model with three entities
Fig 1. CA Plex Object Browser
These represent a standard Grandparent, Parent, Child hierarchy. These could have been modelled differently without ‘Owned By’ etc but that modelling approach is debate for another day. For now the triples that describe this 3 tier relationship have been entered as below.
Fig 2. The selected entities definition triples.
Taking a closer look at Entity ‘LV3 level 3’ you will see its entity attributes described as
Fig 3. The entity attributes showing no overrides.
i.e. Very simple and no attributes and no renaming of fields etc.
We implemented a policy at our shop of using TLA (Three letter acronyms) to describe of business entities and we like to replace the inherited field names whether they are resolved via a Owned By, Refers to or even as virtual fields. This is just a ‘in-house’ preference and (we feel) aides with the myriad of people who need to write queries, data warehouse data extraction and other extracts like data downloads and excel spreadsheets.
We also tend to follow through the TLS naming convention for our tables (physical files) and views etc rather than defaulting to the generated names.
Fig 4. The File and Implementation names for the table and default views.
And I haven’t even covered labels for the fields and entity and field narratives. As you are all aware this can lead to quite a bit of entry on our part for even a simple entity.
HENCE MY LITTLE UTILITY!!!!!.
I introduce the aptly named ‘Entity Creator’, I wanted to say that with a Boxing Ring influenced Master of Ceremonies voice but realised that wouldn’t translate on a textual blog.
Entity Creator as described a little above is a wizard that guides the developer through the perilous task of setting up an entity and its fields. (Currently tailored to our environment, but adaptable and extendable enough for others to take a look).
So let’s for demonstrable purposes add an extra level to our setup called ‘LVL Level 4’.
Fig 5. The first of the Wizard screens.
By not selecting a Surrogate based key we are therefore selecting natural keys and we get an opportunity to enter the ‘Owned By’ and ‘Known By’ relationships.
Fig 6. Natural keys showing ‘Owned By’ entities for selection.
This shows a selection of ‘Owned By’ and a list of the business entities in the model. The application stores a list of the business entities so some set up is required for old models but that would be straight forward to complete or I might even just import them sometime in the future. Roadmap item?
You will see that the keys of the chosen entity are displayed for instant developer feedback.
Fig 7. Natural keys showing ‘Known By’ field and the options for key selection.
Now let’s enter the ‘Known By’ for this entity. You will see that a different field set up is presented to the user and you simply enter the field name (The prefix is automatically applied so no need to repeat this). And the select from a choice of fields (Configuration roadmap item already noted J).
If applicable the character length and decimal places override are available. If these are left blank the details as depicted on the screen apply through normal inheritance.
Note: As I was new to C# and .NET (DotNet) I decided to hard this to 5 fields. I don’t regret doing this from a learning perspective but I will refactor the application in the future to perhaps display these in the different way.
Clicking next will take us to the Field Labels and Narrative screen which can be bypassed (if you wish).
Fig 8. Editing of the labels for a field.
You will see I have indicated the values for the labels and field narrative for the ‘Known By’ The ‘Owned by’ labels and narratives are already present due to the inheritance (assuming you entered them). In the future this screen will also handle the non key attributes, refers to and virtual fields too. I’ve just got to get a bit better at Dot Net first.
The final screen is the confirmation screen.
You get to choose what triples/objects are or are not created for your entity and also you can see the statistics i.e. what was created. ‘Show Summary only’ is the number of objects, triples and narratives and the timings. ‘Summary and Detail’
Once you have created the entity you should see something like this.
Fig 9. Options for what we want created and the user feedback.
This is 17 objects, 33 triples and 2 narratives created and entered in 377ms. Not bad aye!!!
Fig 10. Some of the new objects, triples and narratives shown in the model.
So I hope you like what you have seen and I thank my company http://www.sasit.co.nz/ with allowing me the time to learn more about these technologies. (Visit our website for ideas on what we can do for your IT business). I hope that this blog inspires you to look at this technology yourself and I’d be delighted to assist with your projects.
Until next time.
Thanks for reading.
Lee.