I am using ORM.Net, which generated the code from the Sql Database as a .dll file.
OS:WindowsXP
.Net 1.1 Version
Language C#
problem description:
I have parent table which has many to one realtion ship to the child table. When i try to take a count of records from the child table it's returns a "ZERO" count. I saw the database and checked that there are values in the child table. The Pk and Fk fields in the correspondin colum are identical. but still i am get the count as "Zero".
answerSetValues.PhraseBook.Contents.Count
answerSetValue is the parent table, PhraseBook is the child, this has a Many to One Relation ship.
If any one has worked on the ORM.Net please let me know the solution for getting the count ASAP.
Below is the method which i am try fetch the count.
int i = 0;
APC.InternalCapture.BusinessObject.AnswerValue[] answerValueBO = new AnswerValue[answerSetValues.PhraseBook.Contents.Count];
foreach(PhraseBook phraseBook in answerSetValues.PhraseBook)
if answerSetValues.PhraseBook.Contents.Count is 0 and then you probably did not "Fetch" the PhraseBook when you got the answerSetValue collection (same thing goes for single objects).
DataManager - is the variable name of the DataManager instance
FetchPath - is what retrives the child and parent objects/relation
FetchPath.answerSetValues - would be the default if you did not specify a FetchPath in you get statement (GetanswerSetValuesCollection)
FetchPath.answerSetValues.PhraseBook - would get all phrasebooks related to each answerSetValues.
Side Note: DataManager.QueryCriteria can be used to filter the answerSetValues and PhraseBook that are retriving from the database as well as using the filterby and findby methods on the collections returned.
Side Note: Never call the Get method on the DataManager for objects that have a composite primary key. Always use one of the parents and the FetchPath to get those objects.
Let me know if you have any other questions
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am using ORM.Net, which generated the code from the Sql Database as a .dll file.
OS:WindowsXP
.Net 1.1 Version
Language C#
problem description:
I have parent table which has many to one realtion ship to the child table. When i try to take a count of records from the child table it's returns a "ZERO" count. I saw the database and checked that there are values in the child table. The Pk and Fk fields in the correspondin colum are identical. but still i am get the count as "Zero".
answerSetValues.PhraseBook.Contents.Count
answerSetValue is the parent table, PhraseBook is the child, this has a Many to One Relation ship.
If any one has worked on the ORM.Net please let me know the solution for getting the count ASAP.
Below is the method which i am try fetch the count.
int i = 0;
APC.InternalCapture.BusinessObject.AnswerValue[] answerValueBO = new AnswerValue[answerSetValues.PhraseBook.Contents.Count];
foreach(PhraseBook phraseBook in answerSetValues.PhraseBook)
{
AddGetPharseBook(phraseBook, ref answerValueBO,i++);
}
private static void AddGetPharseBook(PhraseBook phraseBook, ref APC.InternalCapture.BusinessObject.AnswerValue[] answerValueBO,int index)
{
answerValueBO[index]= new AnswerValue();
answerValueBO[index].AnswerValueID = Convert.ToString (phraseBook.TextID);
answerValueBO[index].Text = phraseBook.PhraseCode;
}
Thanks!!
if answerSetValues.PhraseBook.Contents.Count is 0 and then you probably did not "Fetch" the PhraseBook when you got the answerSetValue collection (same thing goes for single objects).
You need to call the following statement
answerSetValuesCollection answerSetValues = DataManager.GetanswerSetValuesCollection(FetchPath.answerSetValues.PhraseBook)
DataManager - is the variable name of the DataManager instance
FetchPath - is what retrives the child and parent objects/relation
FetchPath.answerSetValues - would be the default if you did not specify a FetchPath in you get statement (GetanswerSetValuesCollection)
FetchPath.answerSetValues.PhraseBook - would get all phrasebooks related to each answerSetValues.
Side Note: DataManager.QueryCriteria can be used to filter the answerSetValues and PhraseBook that are retriving from the database as well as using the filterby and findby methods on the collections returned.
Side Note: Never call the Get method on the DataManager for objects that have a composite primary key. Always use one of the parents and the FetchPath to get those objects.
Let me know if you have any other questions