locked
What am I doing wrong? RRS feed

  • Question

  • I'm probably doing something wrong here but here's a snippet of some code.  If it's broken into two modules it doesn't generate SQL code.  If I put it into a single module it works.  Am I doing something wrong?  As I have it below it works.  

    Thanks

    module Teamer.Core
    {
        type Entity
        {
            EntityId : Integer64 = AutoNumber();
            EntityTypeId : Integer32;
            EntityStatusId : Integer32;
            EnteredBy : Text#50;
            EnteredDate : Date;
        } where identity EntityId;
        Entities : Entity*;

        type Activity
        {
            ActivityId : Integer64 = AutoNumber();
            ActivityTypeId : Integer32;
            ActivityDate : Date;
            EnteredBy : Text# 50;
            EnteredDate : Date;
        } where identity ActivityId;
        Activities : Activity*;

    // if this is broken into 2 modules I can't get the element declaration for ProjectActivityId
    //Project compile errors:
    //file:///C:/Temp/Oslo/IsThisABug.m(31,41): error M0118: Cannot resolve the reference to 'Activity'.
    //file:///C:/Temp/Oslo/IsThisABug.m(31,56): error M0162: Could not bind 'value'.

    //} 

    //module Teamer.Project
    //{
    //    import Teamer.Core;

        type Project{ 
            ProjectId : Integer64 = AutoNumber();
            ProjectActivityId : Activity where value in Activities;                                                               // toggle this with the next line when trying as separate modules
    //        ProjectActivityId : Teamer.Core.Activity where value in Teamer.Core.Activities;
         Name : Text#100;
         Description : Text#100;
         ProjectStatusId : Integer64;
         OwnerEntityId : Integer64;
         ManagerEntityId : Integer64;
         EnteredBy : Text#50;
         EnteredDate : Date;
         DeletedDate : Date; } where identity ProjectId;
        Projects : Project*;
        
        type Task{
         TaskId : Integer64 = AutoNumber();
         ProjectActivityId : Project where value in Projects;
         Name : Text;
         Description : Text;
         StatusCodeId : Integer64;
         ParentTaskId : Integer64;
         ChildTaskId : Integer64;
         EnteredBy : Text#50;
         EnteredDate : Date;
         DeletedDate : Date; } where identity TaskId;
        Tasks : Task*;   
    }

     
    Lou
    Saturday, December 6, 2008 11:42 PM

Answers

  •  OK Duhh, I answered my own question: I didn't export the types.  I fixed it up and posted it below.  Works fine now.   I added another module for Teamer.SQL where the extents are declared.  This is best practice? 

    I'm using a two part module name "Teamer.Core", "Teamer.Project" etc. because I'm trying to maintain a set of application related schemas inside my sql implementation.  To my mind it seems better to identify a primary namespace of  "Teamer" with sub schemas of Core, Project etc rather than putting it into the soup of schemas in the Repository... OR should I change my paradigm and approach this as an SOA and not put the Teamer fence around the modules?

    Thanks

    module Teamer.Core  // this works fine
    {  
        export Activity;  
        export Entity;  
          
        type Entity  
        {  
            EntityId : Integer64 = AutoNumber();  
            EntityTypeId : Integer32;  
            EntityStatusId : Integer32;  
            EnteredBy : Text#50;  
            EnteredDate : Date;  
        } where identity EntityId;  
     
        type Activity  
        {  
            ActivityId : Integer64 = AutoNumber();  
            ActivityTypeId : Integer32;  
            ActivityDate : Date;  
            EnteredBy : Text# 50;  
            EnteredDate : Date;  
        } where identity ActivityId;  
    }    
     
    module Teamer.Project  
    {  
        import Teamer.Core;  
        import Teamer.SQL;  
     
        type Project{   
         ProjectId : Integer64 = AutoNumber();  
         ProjectActivityId : Activity where value in Activities;
         Name : Text#100;  
         Description : Text#100;  
         ProjectStatusId : Integer64;  
         OwnerEntityId : Integer64;  
         ManagerEntityId : Integer64;  
         EnteredBy : Text#50;  
         EnteredDate : Date;  
         DeletedDate : Date; } where identity ProjectId;  
        Projects : Project*;  
           
        type Task{  
         TaskId : Integer64 = AutoNumber();  
         ProjectActivityId : Project where value in Projects;  
         Name : Text;  
         Description : Text;  
         StatusCodeId : Integer64;  
         ParentTaskId : Integer64;  
         ChildTaskId : Integer64;  
         EnteredBy : Text#50;  
         EnteredDate : Date;  
         DeletedDate : Date; } where identity TaskId;  
        Tasks : Task*;      
    }  
     
    module Teamer.SQL  
    {  
        import Teamer.Core;  
        export Activities;  
        export Entities;  
     
        Entities : Entity*;  
        Activities : Activity*;  
    }  
     

    Lou
    Sunday, December 7, 2008 1:43 PM