<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.lhotka.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CSLA .NET discussion</title><link>http://forums.lhotka.net/forums/5.aspx</link><description>General discussion about CSLA .NET</description><dc:language /><generator>CommunityServer 2008.5 SP3 (Build: 36.8414)</generator><item><title>Re: https://www.google.com/accounts/o8/id</title><link>http://forums.lhotka.net/forums/thread/53056.aspx</link><pubDate>Tue, 26 Jun 2012 16:05:28 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:53056</guid><dc:creator>RockfordLhotka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/53056.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=53056</wfw:commentRss><description>&lt;p&gt;Jonny is describing exactly what I am saying, yes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: https://www.google.com/accounts/o8/id</title><link>http://forums.lhotka.net/forums/thread/53051.aspx</link><pubDate>Tue, 26 Jun 2012 13:17:15 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:53051</guid><dc:creator>maxg13</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/53051.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=53051</wfw:commentRss><description>&lt;p&gt;Rock, thanks for your reply. &amp;nbsp;How about this post?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://forums.lhotka.net/forums/p/10711/50007.aspx"&gt;http://forums.lhotka.net/forums/p/10711/50007.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The solution provided by JonnyBee is similar to what I was looking for. &amp;nbsp;I am currently in the middle of coding that solution in my app. &amp;nbsp;Can you provide your insight on this solution?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: https://www.google.com/accounts/o8/id</title><link>http://forums.lhotka.net/forums/thread/53046.aspx</link><pubDate>Mon, 25 Jun 2012 23:21:55 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:53046</guid><dc:creator>RockfordLhotka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/53046.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=53046</wfw:commentRss><description>&lt;p&gt;To create a base class you really need to make it MyBusinessBase&amp;lt;T&amp;gt; so the real business class is&lt;/p&gt;
&lt;p&gt;public class MyRealClass : MyBusinessBase&amp;lt;MyRealClass&amp;gt;&lt;/p&gt;
&lt;p&gt;The way CSLA uses generics in the base&amp;nbsp;classes assumes T is always the type of the real business class.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>https://www.google.com/accounts/o8/id</title><link>http://forums.lhotka.net/forums/thread/53041.aspx</link><pubDate>Mon, 25 Jun 2012 20:06:09 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:53041</guid><dc:creator>maxg13</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/53041.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=53041</wfw:commentRss><description>&lt;p&gt;
&lt;p&gt;I would like to implement Factory Pattern in CSLA. I can use an abstract base class or an interface for the abstraction. I have decided to use an abstract class, only because I have certain common functionality such as, saving to store, retrieving from store, and deletion of the record. Also, some properties that would apply to all implemented objects.&lt;/p&gt;
&lt;p&gt;C# only allows for inheritance from one class, so I can either use BusinessBase or the abstract class. I would also like the concrete types to have their own set of business rules. How can this be done with CSLA?&lt;/p&gt;
&lt;p&gt;If I do what I have listed below, will the rules in both the abstract class as well as the concrete class get fired?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Some code ...&lt;/p&gt;
&lt;p&gt;Abstract class:&lt;/p&gt;
&lt;p&gt;public class Form : BusinessBase&amp;lt;Form&amp;gt; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;private static PropertyInfo&amp;lt;string&amp;gt; FormNameProperty = RegisterProperty&amp;lt;string&amp;gt;(c =&amp;gt; c.FormName);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;public string FormName&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; get { return GetProperty(FormNameProperty); }&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;public abstract void LoadContent();&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;protected override void AddBusinessRules()&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // business rules that are commmon for all implementations&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Concrete implementation:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;public class FormA : Form {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;private static PropertyInfo&amp;lt;string&amp;gt; FirstNameProperty = RegisterProperty&amp;lt;string&amp;gt;(c =&amp;gt; c.FirstName);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;public string FirstName&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; get { return GetProperty(FirstNameProperty); }&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;public override void LoadContent(){&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // some custom code&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;protected override void AddBusinessRules()&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // business rules that only apply to this class&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Factory:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;public static class FormFactory{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;public static Form GetForm(string formanmae) {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Type formType = GetFormType(formName);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if(formType == null)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return null;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; var form = Activator.CreateInstance(formType) as ReferralForm;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return form;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>