Hi All,
I have a serialized Invoice Class inherited BusinessBase class and a member InvoiceDetailsList (BusinessListBase) of InvoiceDetail(BusinessBase) is define withevents.
And also defined business rule as If Invoice amount and Detials.sum donot match brake the rule.
And in AddBusinessRules Added Rule as
ValidationRules.AddRule(Of Invoice)(AddressOf ExpenseSumRule(Of Invoice), "InvoiceAmount")
ValidationRules.AddDependantProperty("Details", "InvoiceAmount", True)
And also defined in Invoice class
Private Sub Details_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles m_details.ListChanged
PropertyHasChanged("Details")
End Sub
When I change my value in my details grid, and Invoice amoutn, mismatch detail sum business rule validation should be checked, and should brake rule. Its working in InProc session state and its failing on Sql Server Sessiion state. It seems PropertyHasChanged on detail is never getting fired and My Business rule is not braking. Where as in Save ( in DataPortal_Insert) Details and Invoice Amounts coming different. How should I handle this behavior. some other business rules which also braking on SQL server Session State.
I'm using 2.1.4.0 version (VB.NET 2005 - Framework 2.0) Is there any solution for it. I read something about Customizing Deserialzation, but couldn't follow. I'm new to CSLA. Please provide me sample
Thanks,
Regards
Soumya
Thanks but I donot want to make any change at CSLA.dll level. I rather prefer change in my Business Object. Can you provide me a sample? It seems even list change event is not getting fired for SS sesion state. Do I do same for that?
Soumya:Thanks but I donot want to make any change at CSLA.dll level. I rather prefer change in my Business Object. Can you provide me a sample? It seems even list change event is not getting fired for SS sesion state. Do I do same for that?
Actually, all you have to do is re-attach event handlers after
BO for Invoice has been de-serialized. You would overrides OnDeserialzed
of Invoice class and re-attach the handler there as in
Sub Protected Overrides OnDesizerilized ….
AddHandler m_details.ListChanged, AddressOf Details_ListChanged
End Sub
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: xAvailx
[mailto:cslanet@lhotka.net]
Sent: Sunday, April 13, 2008 8:32 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] Sql Server Session State and Business Rule not
braking, works good on InProc. CSLA version 2.1.4.0
Soumya:
Thanks but I donot want to make any change at CSLA.dll level. I rather prefer change in my Business Object. Can you provide me a sample? It seems even list change event is not getting fired for SS sesion state. Do I do same for that?
In your BO, implement the interface.
public class YourBO : BusinessBase, IDeserializationCallback
Then re-attach your rules:
public virtual void OnDeserialization(object sender) {
// do things here - re-hook parents, etc.
AddBusinessRules();
}
If you don't fix in csla, then I would suggest you create a base class and
implement there, otherwise all your businessbase bos will need this.
HTH.
In CSLA .NET 2.0 and higher you don't need to implement IDeserializationCallback. Microsoft changed the serializers to use an attribute-based scheme, and BusinessBase already takes care of the hard parts. You just need to override OnDeserialized() in your code to rehook events, etc.
In CSLA .NET 3.5 you don't need to do anything - CSLA takes care of rehooking child events and other child object details automatically.
hello Soumya,
as here you are facing problems about inherited Business Base rules, it would be better to have a knowledge based business suite working for your rules based systems. I had faced some similar technical problems while working for my organization after which I moved to few solution providers. And as I know some of providers, one is Easyrules that provides Business knowledge management software and it’s totally user friendly software and I am almost satisfied with this software.
Anderson:hello Soumya,
as here you are facing problems about inherited Business Base rules, it would be better to have a knowledge based business suite working for your rules based systems. I had faced some similar technical problems while working for my organization after which I moved to few solution providers. And as I know some of providers, one is Easyrules that provides Business knowledge management software and it’s totally user friendly software and I am almost satisfied with this software.
Copyright (c) Marimer LLC