Cinch : A Code Generator Is Coming

A while ago I released my Cinch MVVM Library out there into the wild, and the reception it was got has been pretty good, so I thank you all for that. When I wrote Cinch, I was aware that there was a bit of code that I was still asking people to write, al  be it they would gain a lot too, such as support for ViewModel controlled data editability/editable object support etc etc.

But there was still a bit of code that users had to write on their own, even if once they inherited from the correct Cinch base class ViewModel (there are 3 choices for that by the way). So I thought how easy it would be to create a code generator to simplify this process. I am pleased to say I am practically done with this and it should be available from the main Cinch site (which has had the source code moved to codeplex for obvious reasons) within a week.

For now here are some earlier preview screen shots:

Creating a new ViewModel

To create a ViewModel all you will need to do is pick your base class, and then pick some properties. Where if the property type you want isn’t present, just go and add it, and it will then be saved and will then become available now and in future.

image

 

Creating a new property

image

Editing the list of globally available property types

Like I said if the property you want is not, you can edit the list of available properties (which are backed up to file), and then use them straight away

image

Saving a ViewModel so you can edit and generate the code later, or edit an existing ViewModels generated code

You can save a ViewModel configuration, so you can come back and re-edit or modify the code that will get generated.

image

Generating The Code

This part is clever, the Cinch Code Generator, will actually attempt to compile your code, and providing all the Types you used are available in the assumed standard Assemblies, It will give you a green or red light. A red light may occur as you picked a property type that is not known about, that may be a custom business object class that you plan to add later. You could fix this to be part of the expected assemblies by editing the Cinch Code generator code. If I have time I may add this feature.

Anyway shown below is a red light that comes out of the compile process, but you WILL always be able to override this and choose to generate the final code anyway. It’s YOUR choice.

image

If All Goes Well, Preview The Code

If everything goes fine, 2 new tabs are shown with the generated code, I decided to split this over a g.cs which is a totally generated code file and should never be hand edited and a .cs file which you can edit. However if you run the Cinch code generator and copy the files it produces, you should be careful not to overwrite your custom part, that would be bad.

image

 

So there you go that’ a taster of what’s coming. Hope you like it. It is not far off believe me, 1 – 2 weeks tops.

Advertisements

10 thoughts on “Cinch : A Code Generator Is Coming

  1. Graeme says:

    What does the Ubuntu icon do?

  2. I’m looking forward to it bud. Bring the Cinch gooey goodness forth.

  3. stefan says:

    Nice … just brig it on… as usual high class presentation and accompanied by first class implementation, I am sure.

  4. sacha says:

    stefan

    nearly done with it now, but yeah I am MOST pleased with it actually. It rocks. Its going to make working with Cinch so so easy.

    Not far off now, just 1 or days more work required. Then I’ll write up a codeproject article and release the code to codeplex.

  5. Dave says:

    I just came across your Cinch framework, and after playing with the demo, I’m looking forward to a generator.

    Great work!

  6. Mukhtar Zayed says:

    to me Cinch is two days old, and after playing with the demo, I’m burning to play with the generator too.

    good job!

    • sacha says:

      Not long now, I promise, I have to write an article for it too, so maybe 1 week, the code is 95% there

  7. Skelly says:

    M-V-VM with Cinch is great.. can’t wait to see the generator!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: