<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>bfsharp Wiki Rss Feed</title><link>http://bfsharp.codeplex.com/wikipage</link><description>bfsharp Wiki Rss Description</description><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=28</link><description>&lt;div class="wikidoc"&gt;8 August 2011: SwitchRule - better rule groups management; Client\Server context, ValidateOnlyOnServerSide&lt;br /&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Wed, 15 Aug 2012 06:21:58 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120815062158A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=27</link><description>&lt;div class="wikidoc"&gt;12 August 2011: I started a blog &lt;a href="http://www.bfsharp.com" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; where I&amp;#39;ll write about BFsharp and how to use it. Today&amp;#39;s post is about hierarchical data.&lt;br /&gt;&lt;br /&gt;8 August 2011: SwitchRule - better rule groups management; Client\Server context, ValidateOnlyOnServerSide&lt;br /&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Fri, 12 Aug 2011 07:25:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110812072532A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=26</link><description>&lt;div class="wikidoc"&gt;12 August 2011: I started a blog &lt;span class="unresolved"&gt;Cannot resolve the wiki link macro, invalid number of inputs.&lt;/span&gt; where I&amp;#39;ll write about BFsharp and how to use it. Today&amp;#39;s post is about hierarchical data.&lt;br /&gt;&lt;br /&gt;8 August 2011: SwitchRule - better rule groups management; Client\Server context, ValidateOnlyOnServerSide&lt;br /&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Fri, 12 Aug 2011 07:25:14 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110812072514A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=25</link><description>&lt;div class="wikidoc"&gt;12 August 2011: I started a blog &amp;lt;h href=&amp;quot;www.bfsharp.com&amp;quot;&amp;gt;here&amp;lt;/a&amp;gt; where I&amp;#39;ll write about BFsharp and how to use it. Today&amp;#39;s post is about hierarchical data.&lt;br /&gt;&lt;br /&gt;8 August 2011: SwitchRule - better rule groups management; Client\Server context, ValidateOnlyOnServerSide&lt;br /&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Fri, 12 Aug 2011 07:24:36 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110812072436A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=24</link><description>&lt;div class="wikidoc"&gt;8 August 2011: SwitchRule - better rule groups management; Client\Server context, ValidateOnlyOnServerSide&lt;br /&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Wed, 10 Aug 2011 07:31:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110810073134A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=23</link><description>&lt;div class="wikidoc"&gt;28 July 2011: Formula DSL language is available in WP7.&lt;br /&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Wed, 27 Jul 2011 21:07:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110727090746P</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=22</link><description>&lt;div class="wikidoc"&gt;27 July 2011: Rules with Automatic Dependency Analysis support in WP7. Now rules can be truly multiplatform (.Net, SL, WP7).&lt;br /&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Wed, 27 Jul 2011 16:17:29 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110727041729P</guid></item><item><title>Updated Wiki: Tutorial</title><link>http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;What is BFsharp?&lt;/h1&gt;
&lt;p&gt;It's a library which provides several services assosiated with entity management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rules - they allow to define reusable code which can be executed in response to property change (strategy pattern).
&lt;/li&gt;&lt;li&gt;DynamicProperties - entity can be extended dynamically. &lt;/li&gt;&lt;li&gt;Formula DSL - textual language which can be used to write rules. Moreover it can be used without rules so as to customize other functionality.
&lt;/li&gt;&lt;li&gt;IsDirty - marks entity as dirty in response to property change. &lt;/li&gt;&lt;li&gt;Entity management - groups entity into aggregates - concepts known from Domain Driven Design. It allows to manage entites in logical groups. Let's take invoice as an example. If any of InvoiceLines (child) is modified or validated the Invoice ( parent )
 should be notified to react accordingly. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It's supported on the following platforms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.Net &lt;/li&gt;&lt;li&gt;Silverlight &lt;/li&gt;&lt;li&gt;WP7 (under development) &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Getting started&lt;/h1&gt;
&lt;p&gt;First of all you need to enable BFsharp support in your code. You can do this using
&lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; or manually adding reference to BFsharp.dll and optionally BFsharp.AOP.dll. BFSharp supports .net 3.5, silverlight 4 (assemblies ending with .SL) and experimentally WP7 (assemblies ending with .WP7). Next you need to derive
 your class from EntityBase&amp;lt;T&amp;gt;, for example:&lt;/p&gt;
&lt;pre&gt;public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;BFsharp relies heavily on INotifyPropertyChanged interface. You can implement it manually or use the aspect which will do everything for you.&lt;/p&gt;
&lt;pre&gt;[NotifyPropertyChanged]
public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}&lt;/pre&gt;
&lt;p&gt;If you can't derive your class from EntityBase because you need to use inheritance for some other purpose or simply you do not have access to the code ( for example compiled class ) there is a way. You have to register extensions for your object.&lt;/p&gt;
&lt;pre&gt;var c = new ClassWithoutSourceCode();
var e= EntityExtensions.RegisterTypedObject(e);
e.CreateValidationRule(x =&amp;gt; x.Name.Length &amp;gt; 3)
    .Start();
&lt;/pre&gt;
&lt;p&gt;Now, you can access BFsharp API from the Extensions property.&lt;/p&gt;
&lt;h1&gt;Rules&lt;/h1&gt;
&lt;p&gt;Rules are one of the many features you can find in BFsharp. They allow to define reusable code which can be executed in response to property change (strategy pattern). There're several types of rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ValidationRule - checks for specified condition and if it's false creates a BrokenRule which can be later used to show error to the end-user in the UI. For example, to check that NetPrice must be greater than zero you could write:
&lt;pre&gt;var p = new Product();
p.Extensions.CreateValidationRule(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithMessage(&amp;quot;NetPrice must be greater than zero.&amp;quot;)
                .Start();
&lt;/pre&gt;
Every time the NetPrice property is changed ( INotifyPropertyChanged ) this rule is evaluated. If predicate is false the rule is said to be broken and a BrokenRule class is created with information about the error. Moreover EntityBase implements several interfaces
 which are used in WPF and Silverlight to display errors automatically.
&lt;pre&gt;p.Extensions.BrokenRules[0].Message.ShouldEqual(&amp;quot;NetPrice must be greater than zero.&amp;quot;);
p.Extensions.BrokenRules[0].Severity.ShouldEqual(BrokenRuleSeverity.Error);
&lt;/pre&gt;
Validation rules can also be specifed using attributes, for example:
&lt;pre&gt;[NotifyPropertyChanged]
public class Customer : EntityBase&amp;lt;Product&amp;gt;
{
    [Required, Email, MaxLength(100)]
    public string Name { get; set; }
    [Range(0,100)]
    public decimal NetPrice { get; set; }
}&lt;/pre&gt;
There are several predefinied rules and you can create your own:
&lt;ol&gt;
&lt;li&gt;Required &lt;/li&gt;&lt;li&gt;MaxLength &lt;/li&gt;&lt;li&gt;Email &lt;/li&gt;&lt;li&gt;Pattern &lt;/li&gt;&lt;li&gt;Range &lt;/li&gt;&lt;li&gt;ShouldBe &lt;/li&gt;&lt;/ol&gt;
They are created and started with InitializeRules method. &lt;/li&gt;&lt;li&gt;BusinessRule - consists of func and target. In response to property changed the formula is recalculated and assigned to target. BusinessRule can also work as a ValidationRule. For example, to automatically calculate GrossPrice from Rate and NetPrice:
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.NetPrice * x.Rate, x =&amp;gt; x.GrossPrice)
                .Start();
&lt;/pre&gt;
You can ask: &amp;quot;Why do I need this? I can encapsulate this forumla in GrossPrice property making it read-only&amp;quot;. However, there are several drawbacks in this approach:
&lt;ol&gt;
&lt;li&gt;This approach is not reusable. &lt;/li&gt;&lt;li&gt;The rule formula cannot be changed without compilation. &lt;/li&gt;&lt;li&gt;There is no support for notification for this property and it's impossible to bind this property to UI.
&lt;/li&gt;&lt;li&gt;Using this approach you cannot implement easily the following scenario: calculate GrossPrice when user changes NetPrice, calucalte NetPrice when user changed GrossPrice - so called rule cycle.
&lt;/li&gt;&lt;/ol&gt;
Moreover BFsharp supports rules created from string (Formula language), you could write:
&lt;pre&gt;p.Extensions.CreateBusinessRule(&amp;quot;GrossPrice=NetPrice*Rate&amp;quot;)
                .Start();
&lt;/pre&gt;
Using this functionality you can easily externalize rules and make them customizable for the end-user\system administrator.
&lt;/li&gt;&lt;li&gt;ActionRules - executes an action in response to a property change. For example you can use it to execute WebService and check the availability of the entered mail.
&lt;pre&gt;var c = new Customer();
c.Extensions.CreateActionRule(x =&amp;gt; CheckIfEmailIsAvailable(x.Email))
                .Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Rules are invoked only if one of the properties used in the rule definition is changed. If you want to specify the dependencies by hand you could write:&lt;/p&gt;
&lt;pre&gt;p.Extensions.CreateValidationRuleWithoutDependency(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithDependencies(x=&amp;gt;x.Tax) // Expression, stronly-typed, compile time name validation
                .WithDependencies(&amp;quot;NetPrice&amp;quot;, &amp;quot;GrossPrice&amp;quot;) // String, usefull for tools and infrastructure code
                .Start();
&lt;/pre&gt;
&lt;p&gt;Althought rules can be added from any place in code, there is a pattern to do it.&lt;/p&gt;
&lt;h1&gt;Validation&lt;/h1&gt;
&lt;p&gt;Extensions object has several member which are used to interact with the validation system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;IsValid - this property tells whether the entity is in a valid state. If rules with automatic dependency are used it's updated in real-time in response to property changed notification. Moreover the property throws INotifyPropertyChanged hence it can be
 binded to UI easily. &lt;/li&gt;&lt;li&gt;Validate - the method allows to validate the entire entity on demand. It's useful when an entity doesn't support INotifyPropertyChange, rules doesn't use automatic dependency or the are started without validation.
&lt;/li&gt;&lt;li&gt;Rules - a collection of rules associated with the current entity. &lt;/li&gt;&lt;li&gt;BrokenRules - a collection of objects which represents erorrs and warnings associated with the current entity.
&lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rule options&lt;/h1&gt;
&lt;p&gt;Rules have several options which can be accessed using properties or Fluent Interface:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rule Name - rules can be named. It can be useful for identifying rules or getting them by name.
&lt;pre&gt;rule.WithName(&amp;quot;NetPriceCalculation&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;DebugString - rules can have debug string which can be useful during debugging. If rule is created using Expression contains the textual body representation.
&lt;pre&gt;var r = e.Extensions.CreateBusinessRule(en =&amp;gt; en.Number2 &amp;#43; 5, en =&amp;gt; en.Number)
                .Start();

// Now r.DebugString is equal to en.Number = (en.Number2 &amp;#43; 5)
&lt;/pre&gt;
&lt;pre&gt;rule.WithDebugString(&amp;quot;Some debug string&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule modes - each rule has one or mode modes which control when they are evaluated\validated or invoked.
&lt;ol&gt;
&lt;li&gt;ValidationRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically validated during startup. The default is Validate.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;BusinessRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls what happens when the rule is started. Available options are: none, validate, evaluate.
&lt;/li&gt;&lt;li&gt;Mode - in response to dependency changed BusinessRule can be evaluated or validated.
&lt;/li&gt;&lt;li&gt;TargetChangeAction - when the target property is changed BF can take the following action: None, Override or Validate. Validate option will evaluate function and then compares it with target, when they are different a broken rule is created. Override strategy
 simply overrides the property with function evaluation. &lt;/li&gt;&lt;li&gt;DisableValidation - by default BusinessRule is validated during its lifetime, that means if target is different from function it creates broken rule. You can disable this behavior with this switch.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;ActionRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically invoked during startup. The default is none.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ol&gt;
There are defined several convinient Fluent Interface methods which control rule modes, the all start with With.
&lt;/li&gt;&lt;li&gt;Tags - every rule has a property named Tag. It can be used to store some user-defined data. There are several helper methods which can interact with rules and tag.
&lt;ol&gt;
&lt;li&gt;EnableByTag - enables all rules with the specified tag &lt;/li&gt;&lt;li&gt;SwitchRulesByTag - enables all rules with the specified tag and disables the rest
&lt;/li&gt;&lt;li&gt;ReevaluateRulesByTag - invoke ( ctionRule) or evaluate (BusinessRule) with the specified tag
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Exception Filter - sometimes rules can throw exceptions. They can be caught by BFsharp infrastructure and processed as a BrokenRule. For example let's take division by zero.
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.GrossPrice / x.NetPrice-1, x =&amp;gt; x.Rate)
                .WithException&amp;lt;DivideByZeroException&amp;gt;(&amp;quot;DivisionByZeroMessage&amp;quot;, BrokenRuleSeverity.Error)
                .Start();

p.NetPrices = 0; // In this line a new BrokenRule is created in response to 
                 // DivisionByZeroException which is thrown from the rule
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Prototypes - rules can be copied. This enables some interesting scenarios, namely rule prototypes. Rules definition can be stored in some kind of repository. At the start of the application it is read and rules are instantiated. Then these prototype
 rules are copied and added to every entity which is created. Prototype rules are faster to create because they do not need to analyze dependencies. It's as fast as memory copy.
&lt;pre&gt;var factory = new RuleFactory≶Entity&amp;gt;();
var rule = factory.CreateValidationRule(en =&amp;gt; en.Number &amp;gt; 5).Start();

var e = new Entity();
e.Extensions.AddRuleFromPrototype(rule).Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Suppression - rules can fire each other. You can disable rule evaluation by other rules using several methods:
&lt;ol&gt;
&lt;li&gt;Suppresses &lt;/li&gt;&lt;li&gt;MutuallySuppressedBy &lt;/li&gt;&lt;li&gt;DisableRecursion &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Rule Priority - if you have two rules which are fired in response to the same property change you can specify which should run first.
&lt;pre&gt;e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule=&amp;quot;one&amp;quot;)
                .WithDependencies(en=&amp;gt;en.Number)
                .Start();

e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule = &amp;quot;two&amp;quot;)
                .WithDependencies(en =&amp;gt; en.Number)
                .WithHighPriority()
                .Start();
&lt;/pre&gt;
Other: WithLowPriority, WithPriority(int priority), WithPriority(RulePriority priority). These methods set an int property Rule.Priority. The greater number the higher priority it represents. You could also use RulePriority enum which defines several priority
 levels:
&lt;pre&gt;public enum RulePriority
{
    VeryLow = -20,
    Low = -10,
    Normal = 0,
    High = 10,
    VeryHigh = 20
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;Dynamic Properties&lt;/h2&gt;
&lt;p&gt;Rules provide a way to extend behavior. Dynamic properties extend the data model.&lt;/p&gt;
&lt;pre&gt;var e = new Entity();
e.Extensions.AddProperty&amp;lt;int&amp;gt;(&amp;quot;name&amp;quot;);

e.Extensions.DynamicProperties[&amp;quot;name&amp;quot;] = 4;
&lt;/pre&gt;
&lt;p&gt;Dynamic Properties support databinding and other technology based on reflection. There is a special property called TypedProxy which provides dynamic class generated based on the definition. It supports INotifyPropertyChanged.&lt;/p&gt;
&lt;pre&gt;object typedProxy = e.Extensions.DynamicProperties.TypedProxy;
&lt;/pre&gt;
&lt;h2&gt;IsDirty&lt;/h2&gt;
&lt;p&gt;It'a mechanism which tells if the entity is edited. It can be used in the user interface to show a modification marker.&lt;/p&gt;
&lt;pre&gt;var p = new Product();
p.Extensions.StartDirtyTracking();
p.Name = &amp;quot;a&amp;quot;;
// p.Extensions.IsDirty is true now&lt;span style="font-family:'Segoe UI','Microsoft Sans Serif',Arial,Geneva,sans-serif"&gt;&lt;span style="white-space:normal"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Wed, 27 Jul 2011 08:58:16 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Tutorial 20110727085816A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=21</link><description>&lt;div class="wikidoc"&gt;24 July 2011: Major performance improvments and expression caching (alpha). To turn it on use ExtensionsOptions.CacheLambdas.&lt;br /&gt;&lt;br /&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Sun, 24 Jul 2011 18:43:58 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110724064358P</guid></item><item><title>Updated Wiki: Tutorial</title><link>http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;What is BFsharp?&lt;/h1&gt;
&lt;p&gt;It's a library which provides several services assosiated with entity management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rules - they allow to define reusable code which can be executed in response to property change (strategy pattern).
&lt;/li&gt;&lt;li&gt;DynamicProperties - entity can be extended dynamically. &lt;/li&gt;&lt;li&gt;Formula DSL - textual language which can be used to write rule formulas. Moreover it can be used without rules so as to customize other functionality.
&lt;/li&gt;&lt;li&gt;IsDirty - marks entity as dirty in response to property change. &lt;/li&gt;&lt;li&gt;Entity management - groups entity into aggregates - concepts known from Domain Driven Design. It allows to manage entites in logical groups. Let's take invoice as an example. If and of InvoiceLines (child) is modified or validated the Invoice ( parent )
 should be notified to react accordingly. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It's supported on the following platforms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.Net &lt;/li&gt;&lt;li&gt;Silverlight &lt;/li&gt;&lt;li&gt;WP7 (under development) &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Getting started&lt;/h1&gt;
&lt;p&gt;First of all you need to enable BFsharp support in your code. You can do this using
&lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; or manually adding reference to BFsharp.dll and optionally BFsharp.AOP.dll. BFSharp supports .net 3.5, silverlight 4 (assemblies ending with .SL) and experimentally WP7 (assemblies ending with .WP7). Next you need to derive
 your class from EntityBase&amp;lt;T&amp;gt;, for example:&lt;/p&gt;
&lt;pre&gt;public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;BFsharp relies heavily on INotifyPropertyChanged interface. You can implement it manually or use the aspect which will do everything for you.&lt;/p&gt;
&lt;pre&gt;[NotifyPropertyChanged]
public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}&lt;/pre&gt;
&lt;p&gt;If you can't derive your class from EntityBase because you need to use inheritance for some other purpose or simply you do not have access to the code ( for example compiled class ) there is a way. You have to register extensions for your object.&lt;/p&gt;
&lt;pre&gt;var c = new ClassWithoutSourceCode();
var e= EntityExtensions.RegisterTypedObject(e);
e.CreateValidationRule(x =&amp;gt; x.Name.Length &amp;gt; 3)
    .Start();
&lt;/pre&gt;
&lt;p&gt;Now, you can access BFsharp API from the Extensions property.&lt;/p&gt;
&lt;h1&gt;Rules&lt;/h1&gt;
&lt;p&gt;Rules are one of the many features you can find in BFsharp. They allow to define reusable code which can be executed in response to property change (strategy pattern). There're several types of rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ValidationRule - checks for specified condition and if it's false creates a BrokenRule which can be later used to show error to the end-user in the UI. For example, to check that NetPrice must be greater than zero you could write:
&lt;pre&gt;var p = new Product();
p.Extensions.CreateValidationRule(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithMessage(&amp;quot;NetPrice must be greater than zero.&amp;quot;)
                .Start();
&lt;/pre&gt;
Every time the NetPrice property is changed ( INotifyPropertyChanged ) this rule is evaluated. If predicate is false the rule is said to be broken and a BrokenRule class is created with information about the error. Moreover EntityBase implements several interfaces
 which are used in WPF and Silverlight to display errors automatically.
&lt;pre&gt;p.Extensions.BrokenRules[0].Message.ShouldEqual(&amp;quot;NetPrice must be greater than zero.&amp;quot;);
p.Extensions.BrokenRules[0].Severity.ShouldEqual(BrokenRuleSeverity.Error);
&lt;/pre&gt;
Validation rules can also be specifed using attributes, for example:
&lt;pre&gt;[NotifyPropertyChanged]
public class Customer : EntityBase&amp;lt;Product&amp;gt;
{
    [Required, Email, MaxLength(100)]
    public string Name { get; set; }
    [Range(0,100)]
    public decimal NetPrice { get; set; }
}&lt;/pre&gt;
There are several predefinied rules and you can create your own:
&lt;ol&gt;
&lt;li&gt;Required &lt;/li&gt;&lt;li&gt;MaxLength &lt;/li&gt;&lt;li&gt;Email &lt;/li&gt;&lt;li&gt;Pattern &lt;/li&gt;&lt;li&gt;Range &lt;/li&gt;&lt;li&gt;ShouldBe &lt;/li&gt;&lt;/ol&gt;
They are created and started with InitializeRules method. &lt;/li&gt;&lt;li&gt;BusinessRule - consists of func and target. In response to property changed the formula is recalculated and assigned to target. BusinessRule can also work as a ValidationRule. For example, to automatically calculate GrossPrice from Rate and NetPrice:
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.NetPrice * x.Rate, x =&amp;gt; x.GrossPrice)
                .Start();
&lt;/pre&gt;
You can ask: &amp;quot;Why do I need this? I can encapsulate this forumla in GrossPrice property making it read-only&amp;quot;. However, there are several drawbacks in this approach:
&lt;ol&gt;
&lt;li&gt;This approach is not reusable. &lt;/li&gt;&lt;li&gt;The rule formula cannot be changed without compilation. &lt;/li&gt;&lt;li&gt;There is no support for notification for this property and it's impossible to bind this property to UI.
&lt;/li&gt;&lt;li&gt;Using this approach you cannot implement easily the following scenario: calculate GrossPrice when user changes NetPrice, calucalte NetPrice when user changed GrossPrice - so called rule cycle.
&lt;/li&gt;&lt;/ol&gt;
Moreover BFsharp supports rules created from string (Formula language), you could write:
&lt;pre&gt;p.Extensions.CreateBusinessRule(&amp;quot;GrossPrice=NetPrice*Rate&amp;quot;)
                .Start();
&lt;/pre&gt;
Using this functionality you can easily externalize rules and make them customizable for the end-user\system administrator.
&lt;/li&gt;&lt;li&gt;ActionRules - executes an action in response to a property change. For example you can use it to execute WebService and check the availability of the entered mail.
&lt;pre&gt;var c = new Customer();
c.Extensions.CreateActionRule(x =&amp;gt; CheckIfEmailIsAvailable(x.Email))
                .Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Rules are invoked only if one of the properties used in the rule definition is changed. If you want to specify the dependencies by hand you could write:&lt;/p&gt;
&lt;pre&gt;p.Extensions.CreateValidationRuleWithoutDependency(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithDependencies(x=&amp;gt;x.Tax) // Expression, stronly-typed, compile time name validation
                .WithDependencies(&amp;quot;NetPrice&amp;quot;, &amp;quot;GrossPrice&amp;quot;) // String, usefull for tools and infrastructure code
                .Start();
&lt;/pre&gt;
&lt;p&gt;Althought rules can be added from any place in code, there is a pattern to do it.&lt;/p&gt;
&lt;h1&gt;Validation&lt;/h1&gt;
&lt;p&gt;Extensions object has several member which are used to interact with the validation system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;IsValid - this property tells whether the entity is in a valid state. If rules with automatic dependency are used it's updated in real-time in response to property changed notification. Moreover the property throws INotifyPropertyChanged hence it can be
 binded to UI easily. &lt;/li&gt;&lt;li&gt;Validate - the method allows to validate the entire entity on demand. It's useful when an entity doesn't support INotifyPropertyChange, rules doesn't use automatic dependency or the are started without validation.
&lt;/li&gt;&lt;li&gt;Rules - a collection of rules associated with the current entity. &lt;/li&gt;&lt;li&gt;BrokenRules - a collection of objects which represents erorrs and warnings associated with the current entity.
&lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rule options&lt;/h1&gt;
&lt;p&gt;Rules have several options which can be accessed using properties or Fluent Interface:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rule Name - rules can be named. It can be useful for identifying rules or getting them by name.
&lt;pre&gt;rule.WithName(&amp;quot;NetPriceCalculation&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;DebugString - rules can have debug string which can be useful during debugging. If rule is created using Expression contains the textual body representation.
&lt;pre&gt;var r = e.Extensions.CreateBusinessRule(en =&amp;gt; en.Number2 &amp;#43; 5, en =&amp;gt; en.Number)
                .Start();

// Now r.DebugString is equal to en.Number = (en.Number2 &amp;#43; 5)
&lt;/pre&gt;
&lt;pre&gt;rule.WithDebugString(&amp;quot;Some debug string&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule modes - each rule has one or mode modes which control when they are evaluated\validated or invoked.
&lt;ol&gt;
&lt;li&gt;ValidationRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically validated during startup. The default is Validate.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;BusinessRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls what happens when the rule is started. Available options are: none, validate, evaluate.
&lt;/li&gt;&lt;li&gt;Mode - in response to dependency changed BusinessRule can be evaluated or validated.
&lt;/li&gt;&lt;li&gt;TargetChangeAction - when the target property is changed BF can take the following action: None, Override or Validate. Validate option will evaluate function and then compares it with target, when they are different a broken rule is created. Override strategy
 simply overrides the property with function evaluation. &lt;/li&gt;&lt;li&gt;DisableValidation - by default BusinessRule is validated during its lifetime, that means if target is different from function it creates broken rule. You can disable this behavior with this switch.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;ActionRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically invoked during startup. The default is none.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ol&gt;
There are defined several convinient Fluent Interface methods which control rule modes, the all start with With.
&lt;/li&gt;&lt;li&gt;Tags - every rule has a property named Tag. It can be used to store some user-defined data. There are several helper methods which can interact with rules and tag.
&lt;ol&gt;
&lt;li&gt;EnableByTag - enables all rules with the specified tag &lt;/li&gt;&lt;li&gt;SwitchRulesByTag - enables all rules with the specified tag and disables the rest
&lt;/li&gt;&lt;li&gt;ReevaluateRulesByTag - invoke ( ctionRule) or evaluate (BusinessRule) with the specified tag
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Exception Filter - sometimes rules can throw exceptions. They can be caught by BFsharp infrastructure and processed as a BrokenRule. For example let's take division by zero.
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.GrossPrice / x.NetPrice-1, x =&amp;gt; x.Rate)
                .WithException&amp;lt;DivideByZeroException&amp;gt;(&amp;quot;DivisionByZeroMessage&amp;quot;, BrokenRuleSeverity.Error)
                .Start();

p.NetPrices = 0; // In this line a new BrokenRule is created in response to 
                 // DivisionByZeroException which is thrown from the rule
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Prototypes - rules can be copied. This enables some interesting scenarios, namely rule prototypes. Rules definition can be stored in some kind of repository. At the start of the application it is read and rules are instantiated. Then these prototype
 rules are copied and added to every entity which is created. Prototype rules are faster to create because they do not need to analyze dependencies. It's as fast as memory copy.
&lt;pre&gt;var factory = new RuleFactory≶Entity&amp;gt;();
var rule = factory.CreateValidationRule(en =&amp;gt; en.Number &amp;gt; 5).Start();

var e = new Entity();
e.Extensions.AddRuleFromPrototype(rule).Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Suppression - rules can fire each other. You can disable rule evaluation by other rules using several methods:
&lt;ol&gt;
&lt;li&gt;Suppresses &lt;/li&gt;&lt;li&gt;MutuallySuppressedBy &lt;/li&gt;&lt;li&gt;DisableRecursion &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Rule Priority - if you have two rules which are fired in response to the same property change you can specify which should run first.
&lt;pre&gt;e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule=&amp;quot;one&amp;quot;)
                .WithDependencies(en=&amp;gt;en.Number)
                .Start();

e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule = &amp;quot;two&amp;quot;)
                .WithDependencies(en =&amp;gt; en.Number)
                .WithHighPriority()
                .Start();
&lt;/pre&gt;
Other: WithLowPriority, WithPriority(int priority), WithPriority(RulePriority priority). These methods set an int property Rule.Priority. The greater number the higher priority it represents. You could also use RulePriority enum which defines several priority
 levels:
&lt;pre&gt;public enum RulePriority
{
    VeryLow = -20,
    Low = -10,
    Normal = 0,
    High = 10,
    VeryHigh = 20
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;Dynamic Properties&lt;/h2&gt;
&lt;p&gt;Rules provide a way to extend behavior. Dynamic properties extend the data model.&lt;/p&gt;
&lt;pre&gt;var e = new Entity();
e.Extensions.AddProperty&amp;lt;int&amp;gt;(&amp;quot;name&amp;quot;);

e.Extensions.DynamicProperties[&amp;quot;name&amp;quot;] = 4;
&lt;/pre&gt;
&lt;p&gt;Dynamic Properties support databinding and other technology based on reflection. There is a special property called TypedProxy which provides dynamic class generated based on the definition. It supports INotifyPropertyChanged.&lt;/p&gt;
&lt;pre&gt;object typedProxy = e.Extensions.DynamicProperties.TypedProxy;
&lt;/pre&gt;
&lt;h2&gt;IsDirty&lt;/h2&gt;
&lt;p&gt;It'a mechanism which tells if the entity is edited. It can be used in the user interface to show a modification marker.&lt;/p&gt;
&lt;pre&gt;var p = new Product();
p.Extensions.StartDirtyTracking();
p.Name = &amp;quot;a&amp;quot;;
// p.Extensions.IsDirty is true now&lt;span style="font-family:'Segoe UI','Microsoft Sans Serif',Arial,Geneva,sans-serif"&gt;&lt;span style="white-space:normal"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 09:30:53 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Tutorial 20110607093053A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://bfsharp.codeplex.com/documentation?version=27</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;What is BusinessFramework&lt;/h1&gt;BusinessFramework is a library that enables rapid application development. It gives developer the following components:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Documentation"&gt;Getting started&lt;/a&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Framework support:
&lt;ul&gt;&lt;li&gt;.Net&lt;/li&gt;
&lt;li&gt;Silverlight&lt;/li&gt;
&lt;li&gt;WP7 (under development)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Entity management&lt;/li&gt;
&lt;li&gt;Business rule engie&lt;/li&gt;
&lt;li&gt;IsDirty&lt;/li&gt;
&lt;li&gt;Undo (under development)&lt;/li&gt;
&lt;li&gt;Formula language&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 09:28:39 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20110607092839A</guid></item><item><title>Updated Wiki: Tutorial</title><link>http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;What is BFsharp?&lt;/h1&gt;
&lt;p&gt;It's a library which provides several services assosiated with entity management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rules - they allow to define reusable code which can be executed in response to property change (strategy pattern).
&lt;/li&gt;&lt;li&gt;DynamicProperties - entity can be extended dynamically. &lt;/li&gt;&lt;li&gt;Formula DSL - textual language which can be used to write rule formulas. Moreover it can be used without rules so as to customize other functionality.
&lt;/li&gt;&lt;li&gt;IsDirty - marks entity as dirty in response to property change. &lt;/li&gt;&lt;li&gt;Entity management - groups entity into aggregates - concepts known from Domain Driven Design. It allows to manage entites in logical groups. Let's take invoice as an example. If and of InvoiceLines (child) is modified or validated the Invoice ( parent )
 should be notified to react accordingly. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It's supported on the following platforms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.Net &lt;/li&gt;&lt;li&gt;Silverlight &lt;/li&gt;&lt;li&gt;WP7 (under development) &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Getting started&lt;/h1&gt;
&lt;p&gt;First of all you need to enable BFsharp support in your code. You can do this using
&lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; or manually adding reference to BFsharp.dll and optionally BFsharp.AOP.dll. BFSharp supports .net 3.5, silverlight 4 (assemblies ending with .SL) and experimentally WP7 (assemblies ending with .WP7). Next you need to derive
 your class from EntityBase&amp;lt;T&amp;gt;, for example:&lt;/p&gt;
&lt;pre&gt;public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;BFsharp relies heavily on INotifyPropertyChanged interface. You can implement it manually or use the aspect which will do everything for you.&lt;/p&gt;
&lt;pre&gt;[NotifyPropertyChanged]
public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}&lt;/pre&gt;
&lt;p&gt;If you can't derive your class from EntityBase because you need to use inheritance for some other purpose or simply you do not have access to the code ( for example compiled class ) there is a way. You have to register extensions for your object.&lt;/p&gt;
&lt;pre&gt;var c = new ClassWithoutSourceCode();
var e= EntityExtensions.RegisterTypedObject(e);
e.CreateValidationRule(x =&amp;gt; x.Name.Length &amp;gt; 3)
    .Start();
&lt;/pre&gt;
&lt;p&gt;Now, you can access BFsharp API from the Extensions property.&lt;/p&gt;
&lt;h1&gt;Rules&lt;/h1&gt;
&lt;p&gt;Rules are one of the many features you can find in BFsharp. They allow to define reusable code which can be executed in response to property change (strategy pattern). There're several types of rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ValidationRule - checks for specified condition and if it's false creates a BrokenRule which can be later used to show error to the end-user in the UI. For example, to check that NetPrice must be greater than zero you could write:
&lt;pre&gt;var p = new Product();
p.Extensions.CreateValidationRule(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithMessage(&amp;quot;NetPrice must be greater than zero.&amp;quot;)
                .Start();
&lt;/pre&gt;
Every time the NetPrice property is changed ( INotifyPropertyChanged ) this rule is evaluated. If predicate is false the rule is said to be broken and a BrokenRule class is created with information about the error. Moreover EntityBase implements several interfaces
 which are used in WPF and Silverlight to display errors automatically.
&lt;pre&gt;p.Extensions.BrokenRules[0].Message.ShouldEqual(&amp;quot;NetPrice must be greater than zero.&amp;quot;);
p.Extensions.BrokenRules[0].Severity.ShouldEqual(BrokenRuleSeverity.Error);
&lt;/pre&gt;
Validation rules can also be specifed using attributes, for example:
&lt;pre&gt;[NotifyPropertyChanged]
public class Customer : EntityBase&amp;lt;Product&amp;gt;
{
    [Required, Email, MaxLength(100)]
    public string Name { get; set; }
    [Range(0,100)]
    public decimal NetPrice { get; set; }
}&lt;/pre&gt;
There are several predefinied rules and you can create your own:
&lt;ol&gt;
&lt;li&gt;Required &lt;/li&gt;&lt;li&gt;MaxLength &lt;/li&gt;&lt;li&gt;Email &lt;/li&gt;&lt;li&gt;Pattern &lt;/li&gt;&lt;li&gt;Range &lt;/li&gt;&lt;li&gt;ShouldBe &lt;/li&gt;&lt;/ol&gt;
They are created and started with InitializeRules method. &lt;/li&gt;&lt;li&gt;BusinessRule - consists of func and target. In response to property changed the formula is recalculated and assigned to target. BusinessRule can also work as a ValidationRule. For example, to automatically calculate GrossPrice from Rate and NetPrice:
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.NetPrice * x.Rate, x =&amp;gt; x.GrossPrice)
                .Start();
&lt;/pre&gt;
You can ask: &amp;quot;Why do I need this? I can encapsulate this forumla in GrossPrice property making it read-only&amp;quot;. However, there are several drawbacks in this approach:
&lt;ol&gt;
&lt;li&gt;This approach is not reusable. &lt;/li&gt;&lt;li&gt;The rule formula cannot be changed without compilation. &lt;/li&gt;&lt;li&gt;There is no support for notification for this property and it's impossible to bind this property to UI.
&lt;/li&gt;&lt;li&gt;Using this approach you cannot implement easily the following scenario: calculate GrossPrice when user changes NetPrice, calucalte NetPrice when user changed GrossPrice - so called rule cycle.
&lt;/li&gt;&lt;/ol&gt;
Moreover BFsharp supports rules created from string (Formula language), you could write:
&lt;pre&gt;p.Extensions.CreateBusinessRule(&amp;quot;GrossPrice=NetPrice*Rate&amp;quot;)
                .Start();
&lt;/pre&gt;
Using this functionality you can easily externalize rules and make them customizable for the end-user\system administrator.
&lt;/li&gt;&lt;li&gt;ActionRules - executes an action in response to a property change. For example you can use it to execute WebService and check the availability of the entered mail.
&lt;pre&gt;var c = new Customer();
c.Extensions.CreateActionRule(x =&amp;gt; CheckIfEmailIsAvailable(x.Email))
                .Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Rules are invoked only if one of the properties used in the rule definition is changed. If you want to specify the dependencies by hand you could write:&lt;/p&gt;
&lt;pre&gt;p.Extensions.CreateValidationRuleWithoutDependency(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithDependencies(x=&amp;gt;x.Tax) // Expression, stronly-typed, compile time name validation
                .WithDependencies(&amp;quot;NetPrice&amp;quot;, &amp;quot;GrossPrice&amp;quot;) // String, usefull for tools and infrastructure code
                .Start();
&lt;/pre&gt;
&lt;p&gt;Althought rules can be added from any place in code, there is a pattern to do it.&lt;/p&gt;
&lt;h1&gt;Validation&lt;/h1&gt;
&lt;p&gt;Extensions object has several member which are used to interact with the validation system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;IsValid - this property tells whether the entity is in a valid state. If rules with automatic dependency are used it's updated in real-time in response to property changed notification. Moreover the property throws INotifyPropertyChanged hence it can be
 binded to UI easily. &lt;/li&gt;&lt;li&gt;Validate - the method allows to validate the entire entity on demand. It's useful when an entity doesn't support INotifyPropertyChange, rules doesn't use automatic dependency or the are started without validation.
&lt;/li&gt;&lt;li&gt;Rules - a collection of rules associated with the current entity. &lt;/li&gt;&lt;li&gt;BrokenRules - a collection of objects which represents erorrs and warnings associated with the current entity.
&lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rule options&lt;/h1&gt;
&lt;p&gt;Rules have several options which can be accessed using properties or Fluent Interface:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rule Name - rules can be named. It can be useful for identifying rules or getting them by name.
&lt;pre&gt;rule.WithName(&amp;quot;NetPriceCalculation&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;DebugString - rules can have debug string which can be useful during debugging. If rule is created using Expression contains the textual body representation.
&lt;pre&gt;var r = e.Extensions.CreateBusinessRule(en =&amp;gt; en.Number2 &amp;#43; 5, en =&amp;gt; en.Number)
                .Start();

// Now r.DebugString is equal to en.Number = (en.Number2 &amp;#43; 5)
&lt;/pre&gt;
&lt;pre&gt;rule.WithDebugString(&amp;quot;Some debug string&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule modes - each rule has one or mode modes which control when they are evaluated\validated or invoked.
&lt;ol&gt;
&lt;li&gt;ValidationRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically validated during startup. The default is Validate.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;BusinessRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls what happens when the rule is started. Available options are: none, validate, evaluate.
&lt;/li&gt;&lt;li&gt;Mode - in response to dependency changed BusinessRule can be evaluated or validated.
&lt;/li&gt;&lt;li&gt;TargetChangeAction - when the target property is changed BF can take the following action: None, Override or Validate. Validate option will evaluate function and then compares it with target, when they are different a broken rule is created. Override strategy
 simply overrides the property with function evaluation. &lt;/li&gt;&lt;li&gt;DisableValidation - by default BusinessRule is validated during its lifetime, that means if target is different from function it creates broken rule. You can disable this behavior with this switch.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;ActionRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically invoked during startup. The default is none.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ol&gt;
There are defined several convinient Fluent Interface methods which control rule modes, the all start with With.
&lt;/li&gt;&lt;li&gt;Tags - every rule has a property named Tag. It can be used to store some user-defined data. There are several helper methods which can interact with rules and tag.
&lt;ol&gt;
&lt;li&gt;EnableByTag - enables all rules with the specified tag &lt;/li&gt;&lt;li&gt;SwitchRulesByTag - enables all rules with the specified tag and disables the rest
&lt;/li&gt;&lt;li&gt;ReevaluateRulesByTag - invoke ( ctionRule) or evaluate (BusinessRule) with the specified tag
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Exception Filter - sometimes rules can throw exceptions. They can be caught by BFsharp infrastructure and processed as a BrokenRule. For example let's take division by zero.
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.GrossPrice / x.NetPrice-1, x =&amp;gt; x.Rate)
                .WithException&amp;lt;DivideByZeroException&amp;gt;(&amp;quot;DivisionByZeroMessage&amp;quot;, BrokenRuleSeverity.Error)
                .Start();

p.NetPrices = 0; // In this line a new BrokenRule is created in response to 
                 // DivisionByZeroException which is thrown from the rule
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Prototypes - rules can be copied. This enables some interesting scenarios, namely rule prototypes. Rules definition can be stored in some kind of repository. At the start of the application it is read and rules are instantiated. Then these prototype
 rules are copied and added to every entity which is created. Prototype rules are faster to create because they do not need to analyze dependencies. It's as fast as memory copy.
&lt;pre&gt;var factory = new RuleFactory≶Entity&amp;gt;();
var rule = factory.CreateValidationRule(en =&amp;gt; en.Number &amp;gt; 5).Start();

var e = new Entity();
e.Extensions.AddRuleFromPrototype(rule).Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Suppression - rules can fire each other. You can disable rule evaluation by other rules using several methods:
&lt;ol&gt;
&lt;li&gt;Suppresses &lt;/li&gt;&lt;li&gt;MutuallySuppressedBy &lt;/li&gt;&lt;li&gt;DisableRecursion &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Rule Priority - if you have two rules which are fired in response to the same property change you can specify which should run first.
&lt;pre&gt;e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule=&amp;quot;one&amp;quot;)
                .WithDependencies(en=&amp;gt;en.Number)
                .Start();

e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule = &amp;quot;two&amp;quot;)
                .WithDependencies(en =&amp;gt; en.Number)
                .WithHighPriority()
                .Start();
&lt;/pre&gt;
Other: WithLowPriority, WithPriority(int priority), WithPriority(RulePriority priority). These methods set an int property Rule.Priority. The greater number the higher priority it represents. You could also use RulePriority enum which defines several priority
 levels:
&lt;pre&gt;public enum RulePriority
{
    VeryLow = -20,
    Low = -10,
    Normal = 0,
    High = 10,
    VeryHigh = 20
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;Dynamic Properties&lt;/h2&gt;
&lt;p&gt;Rules provide a way to extend behavior. Dynamic properties extend the data model.&lt;/p&gt;
&lt;pre&gt;var e = new Entity();
e.Extensions.AddProperty&amp;lt;int&amp;gt;(&amp;quot;name&amp;quot;);

e.Extensions.DynamicProperties[&amp;quot;name&amp;quot;] = 4;
&lt;/pre&gt;
&lt;p&gt;Dynamic Properties support databinding and other technology based on reflection. There is a special property called TypedProxy which provides dynamic class generated based on the definition. It supports INotifyPropertyChanged.&lt;/p&gt;
&lt;pre&gt;object typedProxy = e.Extensions.DynamicProperties.TypedProxy;
&lt;/pre&gt;
&lt;h2&gt;IsDirty&lt;/h2&gt;
&lt;p&gt;It'a mechanism which tells if the entity is edited. It can be used in the user interface to show a modification marker.&lt;/p&gt;
&lt;pre&gt;var p = new Product();
p.Extensions.StartDirtyTracking();
p.Name = &amp;quot;a&amp;quot;;
// p.Extensions.IsDirty is true now&lt;span style="font-family:'Segoe UI','Microsoft Sans Serif',Arial,Geneva,sans-serif"&gt;&lt;span style="white-space:normal"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 09:23:15 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Tutorial 20110607092315A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://bfsharp.codeplex.com/documentation?version=26</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;What is BusinessFramework&lt;/h1&gt;BusinessFramework is a library that enables rapid application development. It gives developer the following components:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Documentation"&gt;Tutorial&lt;/a&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Framework support:
&lt;ul&gt;&lt;li&gt;.Net&lt;/li&gt;
&lt;li&gt;Silverlight&lt;/li&gt;
&lt;li&gt;WP7 (under development)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Entity management&lt;/li&gt;
&lt;li&gt;Business rule engie&lt;/li&gt;
&lt;li&gt;IsDirty&lt;/li&gt;
&lt;li&gt;Undo (under development)&lt;/li&gt;
&lt;li&gt;Formula language&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Features&amp;referringTitle=Documentation"&gt;Full features list&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Backlog&amp;referringTitle=Documentation"&gt;Backlog&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 09:22:47 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20110607092247A</guid></item><item><title>Updated Wiki: Tutorial</title><link>http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;What is BFsharp?&lt;/h1&gt;
&lt;p&gt;It's a library which provides several services assosiated with entity management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rules - they allow to define reusable code which can be executed in response to property change (strategy pattern).
&lt;/li&gt;&lt;li&gt;DynamicProperties - entity can be extended dynamically. &lt;/li&gt;&lt;li&gt;Formula DSL - textual language which can be used to write rule formulas. Moreover it can be used without rules so as to customize other functionality.
&lt;/li&gt;&lt;li&gt;IsDirty - marks entity as dirty in response to property change. &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Getting started&lt;/h1&gt;
&lt;p&gt;First of all you need to enable BFsharp support in your code. You can do this using
&lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; or manually adding reference to BFsharp.dll and optionally BFsharp.AOP.dll. BFSharp supports .net 3.5, silverlight 4 (assemblies ending with .SL) and experimentally WP7 (assemblies ending with .WP7). Next you need to derive
 your class from EntityBase&amp;lt;T&amp;gt;, for example:&lt;/p&gt;
&lt;pre&gt;public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;BFsharp relies heavily on INotifyPropertyChanged interface. You can implement it manually or use the aspect which will do everything for you.&lt;/p&gt;
&lt;pre&gt;[NotifyPropertyChanged]
public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}&lt;/pre&gt;
&lt;p&gt;If you can't derive your class from EntityBase because you need to use inheritance for some other purpose or simply you do not have access to the code ( for example compiled class ) there is a way. You have to register extensions for your object.&lt;/p&gt;
&lt;pre&gt;var c = new ClassWithoutSourceCode();
var e= EntityExtensions.RegisterTypedObject(e);
e.CreateValidationRule(x =&amp;gt; x.Name.Length &amp;gt; 3)
    .Start();
&lt;/pre&gt;
&lt;p&gt;Now, you can access BFsharp API from the Extensions property.&lt;/p&gt;
&lt;h1&gt;Rules&lt;/h1&gt;
&lt;p&gt;Rules are one of the many features you can find in BFsharp. They allow to define reusable code which can be executed in response to property change (strategy pattern). There're several types of rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ValidationRule - checks for specified condition and if it's false creates a BrokenRule which can be later used to show error to the end-user in the UI. For example, to check that NetPrice must be greater than zero you could write:
&lt;pre&gt;var p = new Product();
p.Extensions.CreateValidationRule(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithMessage(&amp;quot;NetPrice must be greater than zero.&amp;quot;)
                .Start();
&lt;/pre&gt;
Every time the NetPrice property is changed ( INotifyPropertyChanged ) this rule is evaluated. If predicate is false the rule is said to be broken and a BrokenRule class is created with information about the error. Moreover EntityBase implements several interfaces
 which are used in WPF and Silverlight to display errors automatically.
&lt;pre&gt;p.Extensions.BrokenRules[0].Message.ShouldEqual(&amp;quot;NetPrice must be greater than zero.&amp;quot;);
p.Extensions.BrokenRules[0].Severity.ShouldEqual(BrokenRuleSeverity.Error);
&lt;/pre&gt;
Validation rules can also be specifed using attributes, for example:
&lt;pre&gt;[NotifyPropertyChanged]
public class Customer : EntityBase&amp;lt;Product&amp;gt;
{
    [Required, Email, MaxLength(100)]
    public string Name { get; set; }
    [Range(0,100)]
    public decimal NetPrice { get; set; }
}&lt;/pre&gt;
There are several predefinied rules and you can create your own:
&lt;ol&gt;
&lt;li&gt;Required &lt;/li&gt;&lt;li&gt;MaxLength &lt;/li&gt;&lt;li&gt;Email &lt;/li&gt;&lt;li&gt;Pattern &lt;/li&gt;&lt;li&gt;Range &lt;/li&gt;&lt;li&gt;ShouldBe &lt;/li&gt;&lt;/ol&gt;
They are created and started with InitializeRules method. &lt;/li&gt;&lt;li&gt;BusinessRule - consists of func and target. In response to property changed the formula is recalculated and assigned to target. BusinessRule can also work as a ValidationRule. For example, to automatically calculate GrossPrice from Rate and NetPrice:
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.NetPrice * x.Rate, x =&amp;gt; x.GrossPrice)
                .Start();
&lt;/pre&gt;
You can ask: &amp;quot;Why do I need this? I can encapsulate this forumla in GrossPrice property making it read-only&amp;quot;. However, there are several drawbacks in this approach:
&lt;ol&gt;
&lt;li&gt;This approach is not reusable. &lt;/li&gt;&lt;li&gt;The rule formula cannot be changed without compilation. &lt;/li&gt;&lt;li&gt;There is no support for notification for this property and it's impossible to bind this property to UI.
&lt;/li&gt;&lt;li&gt;Using this approach you cannot implement easily the following scenario: calculate GrossPrice when user changes NetPrice, calucalte NetPrice when user changed GrossPrice - so called rule cycle.
&lt;/li&gt;&lt;/ol&gt;
Moreover BFsharp supports rules created from string (Formula language), you could write:
&lt;pre&gt;p.Extensions.CreateBusinessRule(&amp;quot;GrossPrice=NetPrice*Rate&amp;quot;)
                .Start();
&lt;/pre&gt;
Using this functionality you can easily externalize rules and make them customizable for the end-user\system administrator.
&lt;/li&gt;&lt;li&gt;ActionRules - executes an action in response to a property change. For example you can use it to execute WebService and check the availability of the entered mail.
&lt;pre&gt;var c = new Customer();
c.Extensions.CreateActionRule(x =&amp;gt; CheckIfEmailIsAvailable(x.Email))
                .Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Rules are invoked only if one of the properties used in the rule definition is changed. If you want to specify the dependencies by hand you could write:&lt;/p&gt;
&lt;pre&gt;p.Extensions.CreateValidationRuleWithoutDependency(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithDependencies(x=&amp;gt;x.Tax) // Expression, stronly-typed, compile time name validation
                .WithDependencies(&amp;quot;NetPrice&amp;quot;, &amp;quot;GrossPrice&amp;quot;) // String, usefull for tools and infrastructure code
                .Start();
&lt;/pre&gt;
&lt;p&gt;Althought rules can be added from any place in code, there is a pattern to do it.&lt;/p&gt;
&lt;h1&gt;Validation&lt;/h1&gt;
&lt;p&gt;Extensions object has several member which are used to interact with the validation system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;IsValid - this property tells whether the entity is in a valid state. If rules with automatic dependency are used it's updated in real-time in response to property changed notification. Moreover the property throws INotifyPropertyChanged hence it can be
 binded to UI easily. &lt;/li&gt;&lt;li&gt;Validate - the method allows to validate the entire entity on demand. It's useful when an entity doesn't support INotifyPropertyChange, rules doesn't use automatic dependency or the are started without validation.
&lt;/li&gt;&lt;li&gt;Rules - a collection of rules associated with the current entity. &lt;/li&gt;&lt;li&gt;BrokenRules - a collection of objects which represents erorrs and warnings associated with the current entity.
&lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rule options&lt;/h1&gt;
&lt;p&gt;Rules have several options which can be accessed using properties or Fluent Interface:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rule Name - rules can be named. It can be useful for identifying rules or getting them by name.
&lt;pre&gt;rule.WithName(&amp;quot;NetPriceCalculation&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;DebugString - rules can have debug string which can be useful during debugging. If rule is created using Expression contains the textual body representation.
&lt;pre&gt;var r = e.Extensions.CreateBusinessRule(en =&amp;gt; en.Number2 &amp;#43; 5, en =&amp;gt; en.Number)
                .Start();

// Now r.DebugString is equal to en.Number = (en.Number2 &amp;#43; 5)
&lt;/pre&gt;
&lt;pre&gt;rule.WithDebugString(&amp;quot;Some debug string&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule modes - each rule has one or mode modes which control when they are evaluated\validated or invoked.
&lt;ol&gt;
&lt;li&gt;ValidationRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically validated during startup. The default is Validate.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;BusinessRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls what happens when the rule is started. Available options are: none, validate, evaluate.
&lt;/li&gt;&lt;li&gt;Mode - in response to dependency changed BusinessRule can be evaluated or validated.
&lt;/li&gt;&lt;li&gt;TargetChangeAction - when the target property is changed BF can take the following action: None, Override or Validate. Validate option will evaluate function and then compares it with target, when they are different a broken rule is created. Override strategy
 simply overrides the property with function evaluation. &lt;/li&gt;&lt;li&gt;DisableValidation - by default BusinessRule is validated during its lifetime, that means if target is different from function it creates broken rule. You can disable this behavior with this switch.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;ActionRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically invoked during startup. The default is none.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ol&gt;
There are defined several convinient Fluent Interface methods which control rule modes, the all start with With.
&lt;/li&gt;&lt;li&gt;Tags - every rule has a property named Tag. It can be used to store some user-defined data. There are several helper methods which can interact with rules and tag.
&lt;ol&gt;
&lt;li&gt;EnableByTag - enables all rules with the specified tag &lt;/li&gt;&lt;li&gt;SwitchRulesByTag - enables all rules with the specified tag and disables the rest
&lt;/li&gt;&lt;li&gt;ReevaluateRulesByTag - invoke ( ctionRule) or evaluate (BusinessRule) with the specified tag
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Exception Filter - sometimes rules can throw exceptions. They can be caught by BFsharp infrastructure and processed as a BrokenRule. For example let's take division by zero.
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.GrossPrice / x.NetPrice-1, x =&amp;gt; x.Rate)
                .WithException&amp;lt;DivideByZeroException&amp;gt;(&amp;quot;DivisionByZeroMessage&amp;quot;, BrokenRuleSeverity.Error)
                .Start();

p.NetPrices = 0; // In this line a new BrokenRule is created in response to 
                 // DivisionByZeroException which is thrown from the rule
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Prototypes - rules can be copied. This enables some interesting scenarios, namely rule prototypes. Rules definition can be stored in some kind of repository. At the start of the application it is read and rules are instantiated. Then these prototype
 rules are copied and added to every entity which is created. Prototype rules are faster to create because they do not need to analyze dependencies. It's as fast as memory copy.
&lt;pre&gt;var factory = new RuleFactory≶Entity&amp;gt;();
var rule = factory.CreateValidationRule(en =&amp;gt; en.Number &amp;gt; 5).Start();

var e = new Entity();
e.Extensions.AddRuleFromPrototype(rule).Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Suppression - rules can fire each other. You can disable rule evaluation by other rules using several methods:
&lt;ol&gt;
&lt;li&gt;Suppresses &lt;/li&gt;&lt;li&gt;MutuallySuppressedBy &lt;/li&gt;&lt;li&gt;DisableRecursion &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Rule Priority - if you have two rules which are fired in response to the same property change you can specify which should run first.
&lt;pre&gt;e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule=&amp;quot;one&amp;quot;)
                .WithDependencies(en=&amp;gt;en.Number)
                .Start();

e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule = &amp;quot;two&amp;quot;)
                .WithDependencies(en =&amp;gt; en.Number)
                .WithHighPriority()
                .Start();
&lt;/pre&gt;
Other: WithLowPriority, WithPriority(int priority), WithPriority(RulePriority priority). These methods set an int property Rule.Priority. The greater number the higher priority it represents. You could also use RulePriority enum which defines several priority
 levels:
&lt;pre&gt;public enum RulePriority
{
    VeryLow = -20,
    Low = -10,
    Normal = 0,
    High = 10,
    VeryHigh = 20
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;Dynamic Properties&lt;/h2&gt;
&lt;p&gt;Rules provide a way to extend behavior. Dynamic properties extend the data model.&lt;/p&gt;
&lt;pre&gt;var e = new Entity();
e.Extensions.AddProperty&amp;lt;int&amp;gt;(&amp;quot;name&amp;quot;);

e.Extensions.DynamicProperties[&amp;quot;name&amp;quot;] = 4;
&lt;/pre&gt;
&lt;p&gt;Dynamic Properties support databinding and other technology based on reflection. There is a special property called TypedProxy which provides dynamic class generated based on the definition. It supports INotifyPropertyChanged.&lt;/p&gt;
&lt;pre&gt;object typedProxy = e.Extensions.DynamicProperties.TypedProxy;
&lt;/pre&gt;
&lt;h2&gt;IsDirty&lt;/h2&gt;
&lt;p&gt;It'a mechanism which tells if the entity is edited. It can be used in the user interface to show a modification marker.&lt;/p&gt;
&lt;pre&gt;var p = new Product();
p.Extensions.StartDirtyTracking();
p.Name = &amp;quot;a&amp;quot;;
// p.Extensions.IsDirty is true now
&lt;/pre&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 09:15:59 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Tutorial 20110607091559A</guid></item><item><title>Updated Wiki: LiveSample</title><link>http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;version=10</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Live Samples&lt;/h1&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" style="height:700px;width:880px;"&gt;&lt;param name="source" value="http://www.bfsharp.com/BFsharp.Samples.SL.xap"&gt;&lt;/param&gt;&lt;param name="windowless" value="true"&gt;&lt;/param&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0"&gt;&lt;/param&gt;&lt;param name="autoUpgrade" value="true"&gt;&lt;/param&gt;&lt;p&gt;You need to install Microsoft Silverlight to view this content. &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.50401.0" style="text-decoration:none;"&gt;Get Silverlight!&lt;br /&gt;&lt;img src="http://go.microsoft.com/fwlink/?LinkID=108181" alt="Get Microsoft Silverlight" style="border-style:none;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/object&gt;&lt;iframe style="visibility:hidden;height:0;width:0;border-width:0;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Tue, 07 Jun 2011 08:09:15 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LiveSample 20110607080915A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=20</link><description>&lt;div class="wikidoc"&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Mon, 23 May 2011 11:15:37 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110523111537A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=19</link><description>&lt;div class="wikidoc"&gt;A new tutorial was created. You can find it &lt;a href="http://bfsharp.codeplex.com/wikipage?title=http%3a%2f%2fbfsharp.codeplex.com%2fwikipage%3ftitle%3dTutorial%26referringTitle%3dDocumentation&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Mon, 23 May 2011 11:14:42 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110523111442A</guid></item><item><title>Updated Wiki: Tutorial</title><link>http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;What is BFsharp?&lt;/h1&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;h1&gt;Getting started&lt;/h1&gt;
&lt;p&gt;First of all you need to enable BFsharp support in your code. You can do this using
&lt;a href="http://nuget.org"&gt;NuGet&lt;/a&gt; or manually adding reference to BFsharp.dll and optionally BFsharp.AOP.dll. BFSharp supports .net 3.5, silverlight 4 (assemblies ending with .SL) and experimentally WP7 (assemblies ending with .WP7). Next you need to derive
 your class from EntityBase&amp;lt;T&amp;gt;, for example:&lt;/p&gt;
&lt;pre&gt;public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;BFsharp relies heavily on INotifyPropertyChanged interface. You can implement it manually or use the aspect which will do everything for you.&lt;/p&gt;
&lt;pre&gt;[NotifyPropertyChanged]
public class Product : EntityBase&amp;lt;Product&amp;gt;
{
    public string Name { get; set; }
    public decimal NetPrice { get; set; }
    public decimal Rate { get; set; }
    public decimal GrossPrice { get; set; }
    public decimal Tax { get; set; }
}&lt;/pre&gt;
&lt;p&gt;If you can't derive your class from EntityBase because you need to use inheritance for some other purpose or simply you do not have access to the code ( for example compiled class ) there is a way. You have to register extensions for your object.&lt;/p&gt;
&lt;pre&gt;var c = new ClassWithoutSourceCode();
var e= EntityExtensions.RegisterTypedObject(e);
e.CreateValidationRule(x =&amp;gt; x.Name.Length &amp;gt; 3)
    .Start();
&lt;/pre&gt;
&lt;p&gt;Now, you can access BFsharp API from the Extensions property:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rules &lt;/li&gt;&lt;li&gt;DynamicProperties &lt;/li&gt;&lt;li&gt;IsDirty &lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rules&lt;/h1&gt;
&lt;p&gt;Rules are one of the many features you can find in BFsharp. They allow to define reusable code which can be executed in response to property change (strategy pattern). There're several types of rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ValidationRule - checks for specified condition and if it's false creates a BrokenRule which can be later used to show error to the end-user in the UI. For example, to check that NetPrice must be greater than zero you could write:
&lt;pre&gt;var p = new Product();
p.Extensions.CreateValidationRule(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithMessage(&amp;quot;NetPrice must be greater than zero.&amp;quot;)
                .Start();
&lt;/pre&gt;
Every time the NetPrice property is changed ( INotifyPropertyChanged ) this rule is evaluated. If predicate is false the rule is said to be broken and a BrokenRule class is created with information about the error. Moreover EntityBase implements several interfaces
 which are used in WPF and Silverlight to display errors automatically.
&lt;pre&gt;p.Extensions.BrokenRules[0].Message.ShouldEqual(&amp;quot;NetPrice must be greater than zero.&amp;quot;);
p.Extensions.BrokenRules[0].Severity.ShouldEqual(BrokenRuleSeverity.Error);
&lt;/pre&gt;
Validation rules can also be specifed using attributes, for example:
&lt;pre&gt;[NotifyPropertyChanged]
public class Customer : EntityBase&amp;lt;Product&amp;gt;
{
    [Required, Email, MaxLength(100)]
    public string Name { get; set; }
    [Range(0,100)]
    public decimal NetPrice { get; set; }
}&lt;/pre&gt;
There are several predefinied rules and you can create your own:
&lt;ol&gt;
&lt;li&gt;Required &lt;/li&gt;&lt;li&gt;MaxLength &lt;/li&gt;&lt;li&gt;Email &lt;/li&gt;&lt;li&gt;Pattern &lt;/li&gt;&lt;li&gt;Range &lt;/li&gt;&lt;li&gt;ShouldBe &lt;/li&gt;&lt;/ol&gt;
They are created and started with InitializeRules method. &lt;/li&gt;&lt;li&gt;BusinessRule - consists of func and target. In response to property changed the formula is recalculated and assigned to target. BusinessRule can also work as a ValidationRule. For example, to automatically calculate GrossPrice from Rate and NetPrice:
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.NetPrice * x.Rate, x =&amp;gt; x.GrossPrice)
                .Start();
&lt;/pre&gt;
You can ask: &amp;quot;Why do I need this? I can encapsulate this forumla in GrossPrice property making it read-only&amp;quot;. However, there are several drawbacks in this approach:
&lt;ol&gt;
&lt;li&gt;This approach is not reusable. &lt;/li&gt;&lt;li&gt;The rule formula cannot be changed without compilation. &lt;/li&gt;&lt;li&gt;There is no support for notification for this property and it's impossible to bind this property to UI.
&lt;/li&gt;&lt;li&gt;Using this approach you cannot implement easily the following scenario: calculate GrossPrice when user changes NetPrice, calucalte NetPrice when user changed GrossPrice - so called rule cycle.
&lt;/li&gt;&lt;/ol&gt;
Moreover BFsharp supports rules created from string (Formula language), you could write:
&lt;pre&gt;p.Extensions.CreateBusinessRule(&amp;quot;GrossPrice=NetPrice*Rate&amp;quot;)
                .Start();
&lt;/pre&gt;
Using this functionality you can easily externalize rules and make them customizable for the end-user\system administrator.
&lt;/li&gt;&lt;li&gt;ActionRules - executes an action in response to a property change. For example you can use it to execute WebService and check the availability of the entered mail.
&lt;pre&gt;var c = new Customer();
c.Extensions.CreateActionRule(x =&amp;gt; CheckIfEmailIsAvailable(x.Email))
                .Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Rules are invoked only if one of the properties used in the rule definition is changed. If you want to specify the dependencies by hand you could write:&lt;/p&gt;
&lt;pre&gt;p.Extensions.CreateValidationRuleWithoutDependency(x =&amp;gt; x.NetPrice &amp;gt; 0)
                .WithDependencies(x=&amp;gt;x.Tax) // Expression, stronly-typed, compile time name validation
                .WithDependencies(&amp;quot;NetPrice&amp;quot;, &amp;quot;GrossPrice&amp;quot;) // String, usefull for tools and infrastructure code
                .Start();
&lt;/pre&gt;
&lt;p&gt;Althought rules can be added from any place in code, there is a pattern to do it.&lt;/p&gt;
&lt;h1&gt;Validation&lt;/h1&gt;
&lt;p&gt;Extensions object has several member which are used to interact with the validation system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;IsValid - this property tells whether the entity is in a valid state. If rules with automatic dependency are used it's updated in real-time in response to property changed notification. Moreover the property throws INotifyPropertyChanged hence it can be
 binded to UI easily. &lt;/li&gt;&lt;li&gt;Validate - the method allows to validate the entire entity on demand. It's useful when an entity doesn't support INotifyPropertyChange, rules doesn't use automatic dependency or the are started without validation.
&lt;/li&gt;&lt;li&gt;Rules - a collection of rules associated with the current entity. &lt;/li&gt;&lt;li&gt;BrokenRules - a collection of objects which represents erorrs and warnings associated with the current entity.
&lt;/li&gt;&lt;/ol&gt;
&lt;h1&gt;Rule options&lt;/h1&gt;
&lt;p&gt;Rules have several options which can be accessed using properties or Fluent Interface:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rule Name - rules can be named. It can be useful for identifying rules or getting them by name.
&lt;pre&gt;rule.WithName(&amp;quot;NetPriceCalculation&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;DebugString - rules can have debug string which can be useful during debugging. If rule is created using Expression contains the textual body representation.
&lt;pre&gt;var r = e.Extensions.CreateBusinessRule(en =&amp;gt; en.Number2 &amp;#43; 5, en =&amp;gt; en.Number)
                .Start();

// Now r.DebugString is equal to en.Number = (en.Number2 &amp;#43; 5)
&lt;/pre&gt;
&lt;pre&gt;rule.WithDebugString(&amp;quot;Some debug string&amp;quot;);
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule modes - each rule has one or mode modes which control when they are evaluated\validated or invoked.
&lt;ol&gt;
&lt;li&gt;ValidationRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically validated during startup. The default is Validate.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;BusinessRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls what happens when the rule is started. Available options are: none, validate, evaluate.
&lt;/li&gt;&lt;li&gt;Mode - in response to dependency changed BusinessRule can be evaluated or validated.
&lt;/li&gt;&lt;li&gt;TargetChangeAction - when the target property is changed BF can take the following action: None, Override or Validate. Validate option will evaluate function and then compares it with target, when they are different a broken rule is created. Override strategy
 simply overrides the property with function evaluation. &lt;/li&gt;&lt;li&gt;DisableValidation - by default BusinessRule is validated during its lifetime, that means if target is different from function it creates broken rule. You can disable this behavior with this switch.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;ActionRule
&lt;ul&gt;
&lt;li&gt;StartupMode - controls whether the rule is automatically invoked during startup. The default is none.
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ol&gt;
There are defined several convinient Fluent Interface methods which control rule modes, the all start with With.
&lt;/li&gt;&lt;li&gt;Tags - every rule has a property named Tag. It can be used to store some user-defined data. There are several helper methods which can interact with rules and tag.
&lt;ol&gt;
&lt;li&gt;EnableByTag - enables all rules with the specified tag &lt;/li&gt;&lt;li&gt;SwitchRulesByTag - enables all rules with the specified tag and disables the rest
&lt;/li&gt;&lt;li&gt;ReevaluateRulesByTag - invoke ( ctionRule) or evaluate (BusinessRule) with the specified tag
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Exception Filter - sometimes rules can throw exceptions. They can be caught by BFsharp infrastructure and processed as a BrokenRule. For example let's take division by zero.
&lt;pre&gt;p.Extensions.CreateBusinessRule(x =&amp;gt; x.GrossPrice / x.NetPrice-1, x =&amp;gt; x.Rate)
                .WithException&amp;lt;DivideByZeroException&amp;gt;(&amp;quot;DivisionByZeroMessage&amp;quot;, BrokenRuleSeverity.Error)
                .Start();

p.NetPrices = 0; // In this line a new BrokenRule is created in response to 
                 // DivisionByZeroException which is thrown from the rule
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Prototypes - rules can be copied. This enables some interesting scenarios, namely rule prototypes. Rules definition can be stored in some kind of repository. At the start of the application it is read and rules are instantiated. Then these prototype
 rules are copied and added to every entity which is created. Prototype rules are faster to create because they do not need to analyze dependencies. It's as fast as memory copy.
&lt;pre&gt;var factory = new RuleFactory≶Entity&amp;gt;();
var rule = factory.CreateValidationRule(en =&amp;gt; en.Number &amp;gt; 5).Start();

var e = new Entity();
e.Extensions.AddRuleFromPrototype(rule).Start();
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Rule Suppression - rules can fire each other. You can disable rule evaluation by other rules using several methods:
&lt;ol&gt;
&lt;li&gt;Suppresses &lt;/li&gt;&lt;li&gt;MutuallySuppressedBy &lt;/li&gt;&lt;li&gt;DisableRecursion &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Rule Priority - if you have two rules which are fired in response to the same property change you can specify which should run first.
&lt;pre&gt;e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule=&amp;quot;one&amp;quot;)
                .WithDependencies(en=&amp;gt;en.Number)
                .Start();

e.Extensions.CreateActionRuleWithoutDependency(en =&amp;gt; lastRule = &amp;quot;two&amp;quot;)
                .WithDependencies(en =&amp;gt; en.Number)
                .WithHighPriority()
                .Start();
&lt;/pre&gt;
Other: WithLowPriority, WithPriority(int priority), WithPriority(RulePriority priority). These methods set an int property Rule.Priority. The greater number the higher priority it represents. You could also use RulePriority enum which defines several priority
 levels:
&lt;pre&gt;public enum RulePriority
{
    VeryLow = -20,
    Low = -10,
    Normal = 0,
    High = 10,
    VeryHigh = 20
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;Dynamic Properties&lt;/h2&gt;
&lt;p&gt;Rules provide a way to extend behavior. Dynamic properties extend the data model.&lt;/p&gt;
&lt;pre&gt;var e = new Entity();
e.Extensions.AddProperty&amp;lt;int&amp;gt;(&amp;quot;name&amp;quot;);

e.Extensions.DynamicProperties[&amp;quot;name&amp;quot;] = 4;
&lt;/pre&gt;
&lt;p&gt;Dynamic Properties support databinding and other technology based on reflection. There is a special property called TypedProxy which provides dynamic class generated based on the definition. It supports INotifyPropertyChanged.&lt;/p&gt;
&lt;pre&gt;object typedProxy = e.Extensions.DynamicProperties.TypedProxy;
&lt;/pre&gt;
&lt;h2&gt;IsDirty&lt;/h2&gt;
&lt;p&gt;It'a mechanism which tells if the entity is edited. It can be used in the user interface to show a modification marker.&lt;/p&gt;
&lt;pre&gt;var p = new Product();
p.Extensions.StartDirtyTracking();
p.Name = &amp;quot;a&amp;quot;;
// p.Extensions.IsDirty is true now
&lt;/pre&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Mon, 23 May 2011 11:08:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Tutorial 20110523110832A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://bfsharp.codeplex.com/documentation?version=25</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;What is BusinessFramework&lt;/h1&gt;BusinessFramework is a library that enables rapid application development. It gives developer the following components:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Tutorial&amp;referringTitle=Documentation"&gt;Tutorial&lt;/a&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Framework support:
&lt;ul&gt;&lt;li&gt;.Net&lt;/li&gt;
&lt;li&gt;Silverlight&lt;/li&gt;
&lt;li&gt;WP7 (under development)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Entity management&lt;/li&gt;
&lt;li&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=BusinessRuleEngine&amp;referringTitle=Documentation"&gt;Business rule engie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;IsDirty&lt;/li&gt;
&lt;li&gt;Undo (under development)&lt;/li&gt;
&lt;li&gt;Formula language&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Features&amp;referringTitle=Documentation"&gt;Full features list&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bfsharp.codeplex.com/wikipage?title=Backlog&amp;referringTitle=Documentation"&gt;Backlog&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Mon, 23 May 2011 11:06:57 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20110523110657A</guid></item><item><title>Updated Wiki: Home</title><link>http://bfsharp.codeplex.com/wikipage?version=18</link><description>&lt;div class="wikidoc"&gt;To view LiveSamples go &lt;a href="http://bfsharp.codeplex.com/wikipage?title=LiveSample&amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now with &lt;a href="http://nuget.org" class="externalLink"&gt;NuGet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; integration - you can find it &lt;a href="http://nuget.org/List/Packages/BFsharp" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BFsharp&lt;/b&gt;&lt;br /&gt;Provides several features which help in building business applications:&lt;br /&gt;- Business rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; BusinessRuleEvaluate()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddBusinessRule(en =&amp;gt; en.Number2 + 5, en =&amp;gt; en.Number);

    e.Extensions.Enable();

    e.Number2 = 5;

    e.Number.ShouldEqual(10);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Formula - text language for writing rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
e.Extensions.AddBusinessRule(&lt;span style="color:#A31515;"&gt;&amp;quot;Number=Number2+Number3&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;You can use Formula without rules&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; compiler = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FormulaCompiler()
    .WithFlatType(&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(Math));

&lt;span style="color:Blue;"&gt;var&lt;/span&gt; f = compiler.NewLambda().
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param1&amp;quot;&lt;/span&gt;).
    WithParam&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#A31515;"&gt;&amp;quot;Param2&amp;quot;&lt;/span&gt;).
    Returns&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;().
    Compile(&lt;span style="color:#A31515;"&gt;&amp;quot;max(@Param1, @Param2) + 4&amp;quot;&lt;/span&gt;);

f(2, 3).ShouldEqual(7);
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;- Validation rules&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Test]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncValidationRule()
{
    &lt;span style="color:Blue;"&gt;var&lt;/span&gt; e = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Entity();
    e.Extensions.AddValidationRule(en =&amp;gt; en.Name == &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;);

    e.Extensions.Enable();

    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(1);
            
    e.Name = &lt;span style="color:#A31515;"&gt;&amp;quot;yol&amp;quot;&lt;/span&gt;;
    e.Extensions.BrokenRules.Count.ShouldEqual(0);
}
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>michaelmac</author><pubDate>Sat, 09 Apr 2011 19:33:39 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110409073339P</guid></item></channel></rss>