Hi,
What is the proper place to put business some more complex business logic 
which requires access to other Models, not only the one on which the 
operation is being executed?
*Are there any open-source projects which uses a bit of business logic and 
could be a good example?*

To make myself clear: all the examples of business logic I've found are 
very simple ones, like *class Person *with calculated property *FullName *which 
is just a getter: FirstName + " " + LastName, or calculating Person's Age 
by theirs BirthDate field.

Now I need some more complex logic, for example to calculate the 
*Invoice*amount based on today's 
*PricingPlan* model which is separate model. 
Where should I implement methods like this? Is the Repository pattern 
supposed to be place for this methods?
Or is it OK to implement these methods in the class it is logically related 
to, just passing the ISession instance to the method, like so:

class Invoice
{
    // ...
    public void CalculatePrice(ISession dbSess)
    {
        var pricePlan = dbSess.Get<PricingPlan>(...); //
    }
}

I come from python/django background, and there's no such problem, since 
the db connection/session management is hidden away from user.

Best regards
MG

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to