Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Clarify - Private backing fields, LoadProperty, and Common rules

$
0
0

Hi there,

Need some clarification on this statement from previous post:

My key issue is that there is a LOT you must make sure to NOT use, such as the standard rules, the CslaContrib rules 
or the CslaGenFork rules.

    Refresh of my situation:

    • I am using DTO from my DAL as a private field in BusinessBase object.  The individual PropertyInfo objects are marked with PrivateField and the Getters/Setters use the GetProperty and SetProperty.
    • I cannot bring myself to write a LoadProperty/ReadProperty overload for every property!  It is too unmaintainable unless I only had a couple properties.

    Currently I am using the CommonRules and they work great!!  Only the DataAnnotation rules do not work.  I debugged the CommonRule, the execution does a Using ByPassPropertyChecks and then calls my getter on the primary property using the DynamicMethodGetter.

    Given the following parameters (question below)

    • I do not use Async rules
    • I do not use the CSLAContrib or CSLAGenFork rules
    • I do not use Input or OutputProperties
    • I do not target async clients (WinRt, WPhone, Silverlight)
    • If I DO ever write an async rule with no Target access OR if I use input/output properties I will do Load/ReadProperty overload for the few relevant properties

    Am I missing something?  Thanks for patience as I understand the guts of what is going on. 

    This code is screaming fast and I like not having to load my business object properties one by one from the DAL layer at fetch and update!  Yes my DTO is tied into my BusinessLayer, but I am willing to live with that for the benefit.

    Extra benefit is I want to spin up a ReadOnly version I can transfer the DTO to a ReadOnly Friend factory method and viola!


    Viewing all articles
    Browse latest Browse all 764

    Trending Articles