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>
9:
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>
20:
21:
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:
37: http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html
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>
49:
50: </configuration>
These new features will be documented in the Cinch MVVM Framework documentation over at www.codeproject.com
Enjoy.
PS : I really am done with Cinch now I feel, those were the last changes I wanted to get in there.


























Philipp said
am December 24 2009 @ 4:08 pm
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
sacha said
am December 24 2009 @ 7:30 pm
Yeah I like it, very easy to setup and use, well done. Thanks
frosty said
am February 2 2010 @ 1:50 pm
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.
Thanks.
sacha said
am February 2 2010 @ 2:55 pm
Cool, go for it. Post a comment here when you are done, I’d like a look
Roberto Dalmonte said
am April 10 2010 @ 2:32 pm
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);
});
}
use:
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.
Roberto
BTW did you become a father already?
In a couple of weeks I’ll have my third boy.