Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UI or BO code?
Message
De
24/08/2010 12:34:46
 
 
À
24/08/2010 11:36:14
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Divers
Thread ID:
01478134
Message ID:
01478172
Vues:
43
>>>From your desc it sounds as if the UI could work the same on both states -
>>>that makes it automatically a biz rule...
>>
>>Thanks, that's my feeling too. Now how do I do this in MM.NET?
>
>Here's what I think needs to be done:
>
>When the BO gets created and data populated I need to check what the status is. If it is not "Pending" then I need to change the BO to think it is in adding mode and change the PK to a new one.
>
>I've created an override HookPostGeteEntity and can check teh status, but how do I raise the statechange so theat MM.NET thinks it's a new record?

I'm having a good conversation with myself today :)

I've tried this:
        protected override void HookPostGetEntity(PolicyEntity policyEntity)
        {
            // check if the entity's status is not "Pending"
            if (policyEntity.StatusFK != (int)StatusCode.Pending)
            {
                // if so, then convert the entity to be a "new" record
                this.CallStateChange(mmBusinessState.Adding);
                policyEntity.PolicyPK = Guid.NewGuid();
            }
        }
but i then get an exception when trying to save:

"this.oPolicy.Exception.Message: "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."

Which I guess means there's more to it than just telling the BO it is in Add mode.

Any help appreciated.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform