New Posts New Posts RSS Feed: New to IdeaBlade Question
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

New to IdeaBlade Question

 Post Reply Post Reply
Author
bsimmons View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Jul-2007
Location: United States
Posts: 3
Post Options Post Options   Quote bsimmons Quote  Post ReplyReply Direct Link To This Post Topic: New to IdeaBlade Question
    Posted: 19-Jul-2007 at 2:22pm
Hi;
I walked thru the tutorials and started into the other docs and IdeaBlade seems to be a outstanding product. I have not yet seen anything which quite matches my environment so I have attempted to describe it below to see if and how IdeaBlade handles it. I hope that I have not over simplifed my table and class defs.
 
I have the following tables in my database

Table:Contact
 Columns:
 PrimaryKey
 EmailAddress
 Name
 PrimaryAddress
 ...

Table:Member
Columns:
 PrimaryKey
 FK_Contact
 First_Name
 Middle_Name
 Last_Name
 Membership_Type
 ....

Table:Visitors
Columns
 PrimaryKey
 FK_Contact
 Dateof1stVisit
 CallBackDesired

My object module look as follows where the Member and Visitor Classes derived from the Contact class matching the tables Definations from above:

    public class Contact
    {
 public Guid PrimayKey;
 public string EmailAddress;
 public string Name;
 pubic string PrimaryAddress;
 ....
    }

    public class Member : Contact
    {
 public Guid PrimayKey;
 public Guid FK_Contact;
 public string First_Name;
 public string Middle_Name;
 pubic string Last_Name;
 pubic string Membership_Type;
 ....
    }

    public class Visitors : Contact
    {
 public Guid PrimayKey;
 public Guid FK_Contact;
 public string Dateof1stVisit;
 public string CallBackDesired;
 ....
    }

Does IdeaBlade support this model?
What Do I need to do to ensure that all of the properties from the Contact Class appear in the Member and Visitor Classes?

I hope this is the correct forum for this question.
Thanks
Bernard.
Back to Top
pkarsh View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 32
Post Options Post Options   Quote pkarsh Quote  Post ReplyReply Direct Link To This Post Posted: 19-Jul-2007 at 6:08pm
Hi Bernard

You may have other reasons for making Member and Visitors classes derive from your Contact class, but from the perspective of making the properties in the Contact class visible to these "child" classes it is not necessary to make them derive from Contact. All you need to do is define the relations between these classes in the Object Mapper. To do this, click on the "View Relations" button in the Object Mapper toolbar. This is the button immediately to the left of the ".NET language" drop down and admittedly it could be better labelled. This will bring up the "Relations" window. Click on the "Add" button to enable the Parent and Child drop down lists. In your case, you will want to specify "Contact" as the parent and "Member" as the child. Select the "PrimaryKey" property from "Contact" and FK_Contact" from "Member". This will cause a join to be defined in the rightmost list box. It is not clear to me whether the relationship between "Contact" and "Member" is 1 -1 or 1 - many, that is, whether or not there are many "Members" for each "Contact" or only one. In any case, select the correct Cardinality for this relationship. Click on the "Add" button again and repeat to define the relationship between the "Contact" and the "Visitors" classes. When you are done defining these relations, click "Save" .

Let us say that you now have an instance of a Member object that we will call "aMember". You can access the values of the Contact class by writing code such as "aMember.Contact.EmailAddress", for example, to access the EmailAddress property of the Contact object that is a parent of the aMember instance.

You define which object instances are parents of a particular child object instance by setting the values to that of the contact object. Let us say that you have a Contact instance called aContact and a Member instance called aMember. You would define aContact as the parent of aMember by simply coding "aMember.Contact = aContact"

Hope this helps.
Back to Top
bsimmons View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Jul-2007
Location: United States
Posts: 3
Post Options Post Options   Quote bsimmons Quote  Post ReplyReply Direct Link To This Post Posted: 20-Jul-2007 at 4:04am
Hi pkarsh
 
Thanks! This helps a lot and by the way the relationship between "Contact" and "Member" and "Contact" and  "Visitor" is 1 - 1. That is the Database was designed. Also, I noticed that the Object Mapper created all of the relations as 1 to Many which is as I would expect.
 
Again thanks for your help.
Bernard
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down