Newbie needing clarification

Newbie needing clarification

Old forum URL: forums.lhotka.net/forums/t/327.aspx


supercodepoet posted on Friday, June 09, 2006

I have a couple of items I need clarified for me.  Suppose I have  a application that has a Case table that keeps information about a case.  A Case must have  a child. A Child table also has related addresses, contact information etc. For the way I see it the Child object could be  a child of the Case object but it could also be  a root object when being edited by itself. You would not always edit a child by going through a case.  So is the Child a child object or a root object? I am having trouble visualizing how it works.

The second question is about Critieria. What do you need to do if you need to be able to pull by more than one criteria? Suppose you need to query by id for a child when you have it in a list or you need to find the child by its natural primary key, first name, last name and birthday? Suppose you want to implement filtering on a list in the UI and need all those filter options as different Criteria.  How is that implemented?

Thank you,
Travis

xal replied on Friday, June 09, 2006

Travis,
Read this and this. You can also search for more posts on the subject (there are plenty) here and in searchcsla.com.

About the criteria, you can have as many criteria objects as you want. And you can create as many DataPortal_Fetch() methods as criteria objects you have.

So, suppose you have a class named CriteriaFiltered then you'd have a
DataPortal_Fetch(ByVal crit as CriteriaFiltered).

If you pass the dataportal a criteria of type CriteriaFiltered the dataportal will figure it has to call a dataportal fetch method that contains a criteria of type CriteriaFiltered. If it doesn't find it, it'll fallback to one that has a parameter of type object like: DataPortal_Fetch(ByVal crit as Object)

So, you could also have just one fetch method with a param of type object and something like:

DataPortal_Fetch(ByVal crit as Object)
If TypeOf crit Is CriteriaFiltered Then
...


Andrés

supercodepoet replied on Friday, June 09, 2006

Another question I had was the following:

We come from the camp that you have  a identity primary key for your table that acts as an Id and then a unqiue constrant on your natural primary key of the data.  When setting up your primary key fields for business objects using CLSA.NET, do you use the identity key, the nautral key ora combination of both? I can see having the Id field for the real primary key and the GetIdValue() method return a combination of the natural primary key for Equals() operations.  In this case which fields do you mark with the System.ComponentModel.DataObjectField(true, true) attribute so data binding will work properly?

Thanks,
Travis

Copyright (c) Marimer LLC