Foreign key in lists and create

Hi,

I’m still testing this product :slight_smile:

I have generated my code with sucess but have a problem when there is foreign keys in a class(table).

Normally when I list some things I do it like this:

DatabaseGeneric.EntityClasses.AnsiCrm_CompanyCriteria companyCriteria = new AnsiCrm_CompanyCriteria();
            companyCriteria.PhoneNo.Eq("1234");
            DatabaseGeneric.EntityClasses.AnsiCrm_Company[] companies = companyCriteria.ListAnsiCrm_Company();

But now I want to do my criteia with one of the tables foreign keys “CustomerId” but can see that there isn’t such one. What to do so I can list the Company table with a critiea from Customer table?

The same thing is when I want to create a new company I do normaly this:

DatabaseGeneric.EntityClasses.AnsiCrm_Company companies = DatabaseGeneric.EntityClasses.AnsiCrm_CompanyDAO.CreateAnsiCrm_Company();
            companies.Name = companyName;
            DatabaseGeneric.EntityClasses.AnsiCrm_CompanyDAO.Save(companies);

Again I want to create the Company with customerId - but such doesn’t exists. Here there is a Customer with I tried to use like this:

DatabaseGeneric.EntityClasses.AnsiCrm_Company companies = DatabaseGeneric.EntityClasses.AnsiCrm_CompanyDAO.CreateAnsiCrm_Company();
            companies.Name = appendixName;
            companies.Customer.ORMID = 1;
            DatabaseGeneric.EntityClasses.AnsiCrm_CompanyDAO.Save(companies);

But then Visual studio sais to me, that ORMID cannot be assigned to - it is read only

So what to do when creating a customer with a customerId (foreign id)?

Hope someone can help me - otherwise I cann’t seehow to use Visual Paradigm in the future. All my projects has foreign keys in the tables.

Kind regards,
simsen :slight_smile: