Cinch : More good news (again sorry)

I have just done another update to my Cinch MVVM Framework which I realise is probably a pain to those of you that are keeping up with the codebase.

I actually feel I am done with it for good now (well until the next time).

So what has changed this time. Well there are only 2 things:

1. Fixed NumericTextBoxBehavior so it now validates pasted contents to ensure its numeric

2. I replaced my own logging service with a more manly logging facade. Now I am a massive fan of Daniel Vaughans work, and he did an excellent job on his logging facade called Clog, But what I wanted for my Cinch MVVM Framework was something that would require hardly any changes. I was originally going to use Clog, but after a bit of a look, I decided to use 2 other WPF Disciples logging facade work called Simple Logging Facade (SLF).

Now this is not to say what Daniel did is bad, cos it sure aint, in fact SLF is really a subset of what Clog can do. Its just for Cinch MVVM Framework SLF seemed an easier (yes I am that lazy) fit.

So Cinch MVVM Framework now uses Simple Logging Facade (SLF), and makes use of the Log4Net facade, so the log entries use the Log4Net style, which can be configured through the App.Config.

Here is an example of the new App.Config required by my Cinch MVVM Framework


   1:  <?xml version="1.0" encoding="utf-8" ?>
   2:  <configuration>
   3:    <configSections>
   4:      <section name="log4net" 
   5:               type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
   6:      <section name="slf" 
   7:               type="Slf.Config.SlfConfigurationSection, slf"/>
   8:    </configSections>
  10:    <slf>
  11:      <factories>
  12:        <!-- configure single log4net factory, 
  13:             which will get all logging output -->
  14:        <!-- Important: Set a reference to the log4net facade 
  15:             library to make sure it will be available at runtime -->
  16:        <factory type="SLF.Log4netFacade.Log4netLoggerFactory, 
  17:                 SLF.Log4netFacade"/>
  18:      </factories>
  19:    </slf>
  22:    <!-- configures log4net to write into a local file called "log.txt" -->
  23:    <log4net>
  24:      <!--  log4net uses the concept of 'appenders' to indicate where 
  25:            log messages are written to.
  26:            Appenders can be files, the console, databases, SMTP and much more
  27:      -->
  28:      <appender name="MainAppender" type="log4net.Appender.FileAppender">
  29:        <param name="File" value="log.txt" />
  30:        <param name="AppendToFile" value="true" />
  31:        <!--  log4net can optionally format the logged messages with a pattern. 
  32:              This pattern string details what information
  33:              is logged and the format it takes. 
  34:              A wide range of information can be logged, including message, 
  35:              thread, identity and more,
  36:              see the log4net documentation for details:
  38:        -->
  39:        <layout type="log4net.Layout.PatternLayout">
  40:          <conversionPattern value="%logger: %date [%thread] 
  41:                             %-5level - %message %newline" />
  42:        </layout>
  43:      </appender>
  44:      <root>
  45:        <level value="ALL" />
  46:        <appender-ref ref="MainAppender" />
  47:      </root>
  48:    </log4net>
  50:  </configuration>

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

These new features will be documented in the Cinch MVVM Framework documentation over at




PS : I really am done with Cinch now I feel, those were the last changes I wanted to get in there.



  1. Great news, Sacha!

    I’m very happy the framework made it into Cinch – given Cinch is really quite awesome, this might get our little façade quite a boost. Hope SLF will serve you well 🙂


  2. Hello Sacha,

    As I commented on CodePlex, I’ve found your Cinch and documentation to be most helpful. However, I’m trying to take some elements of Prism and use some of the things in Cinch and mix and Match.

    My mindset has been to focus on modules and in your sames, you use your own display methods.

    I tried to find your contact info but haven’t had any success.

    At anypoint, I’m going to start new assembly and pick and match things I find useful. Much of what you claim to have done with Cinch.

    But I wanted to let you now before I got started into it.



  3. Hi Sacha, I’m using ample portions of your Cinch framework and I find it WONDERFUL. I FxCopped the portions I’m using and and found a useful suggestion:

    Instead of

    private static SimpleRule firstNameRule;
    static CustomerModel()

    firstNameRule = new SimpleRule(“DataValue”, “Firstname can not be empty”,
    (Object domainObject)=>
    DataWrapper obj = (DataWrapper)domainObject;
    return String.IsNullOrEmpty(obj.DataValue);


    private static SimpleRule firstNameRule = new SimpleRule(“DataValue”, “Firstname can not be empty”,
    (Object domainObject) =>
    DataWrapper obj = (DataWrapper)domainObject;
    return String.IsNullOrEmpty(obj.DataValue);

    This way, as FxCop says, you can get rid of the Static Constructor and instantiate the SimpleRule in the very same moment you declare it, gaining some performance improvement.
    Appears reasonable to me. Do you think is a proper thing to do?
    Best regards.
    BTW did you become a father already?
    In a couple of weeks I’ll have my third boy.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s