.NET Framework Developer Center > .NET Development Forums > Microsoft SQL Server Modeling > Value in an entity referenced to another entity field
Ask a questionAsk a question
 

AnswerValue in an entity referenced to another entity field

  • Tuesday, October 06, 2009 12:23 PMryszarddrozd Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello!

    How value in an entity referenced to another entity field?

    I have example type(s):

        type LocaleDictionary
        {
            id : PK => AutoNumber(); // type PK : Integer64;
            name : Text#40;
            displayname : Text#40;
        } where identity (id), unique(name);
       
        Locales: LocaleDictionary*;
       
        Locales
        {
            en { name => "en", displayname => "Angielski"},
            // ...
            de { name => "de", displayname => "Niemiecki"}
        }


     type SimpleDictionary
     {
      id : PK => AutoNumber();
      name : Text#40;
      displayname : Text#40;
      defaultLocale : LocaleDictionary where value in Locales;
      active : Logical => true;
      visible : Logical => true;
      usefrom : DateTime;
      useto : DateTime?;
     } where identity (id), unique(name);


     type KindType : SimpleDictionary
     {
      parent : KindType? where value in Kind;
     };
       
        type LocaleKindType
        {
            id : PK => AutoNumber();
            displayname : Text#40;
            displaynameLocale : LocaleDictionary where value in Locales;
            idKind : KindType where value in Kind;
        } where identity (id), unique(displaynameLocale, idKind);

     Kind : KindType*;
     LocaleKind : LocaleKindType*;

    // I define here Kind with displayname ='Root' and default locale == 'en'
    Kind {KindRoot {name => "Root", displayname => "Root", defaultLocale => Locales.en, visible => false, usefrom => 2000-01-01T00:00:00}}

    // [1]
    // This work. But is not elegant, see displaynameLocale.
    //LocaleKind {LocaleKindRoot {displayname => Kind.KindRoot.displayname, displaynameLocale => Locales.en, idKind => Kind.KindRoot}}

    // [2]
    // This does not work.
    LocaleKind {LocaleKindRoot {displayname => Kind.KindRoot.displayname, displaynameLocale => Kind.KindRoot.defaultLocale, idKind => Kind.KindRoot}}

    Take a look at [1] and [2].
    Displayname field in LocaleKindType is referenced to displayname field in KindRoot. But, displaynameLocale in LocaleKindType can't reference defaultLocale field in KindRoot.

    How to reference value in LocaleKindRoot to defaultLocale in KindType entity (KindRoot)?

    More precisely: how to reference fields in LocaleKindRoot (displaynameLocale) and in KindRoot (defaultLocale) to the same value?

    Thanks and Regards

    • Edited byryszarddrozd Tuesday, October 06, 2009 1:31 PMentity names
    • Edited byryszarddrozd Tuesday, October 06, 2009 12:46 PMtypo
    • Edited byryszarddrozd Tuesday, October 06, 2009 1:29 PMQuestion added
    • Edited byryszarddrozd Tuesday, October 06, 2009 12:52 PMtypo, again!
    •  

Answers

  • Monday, October 12, 2009 4:31 AMKraig BrockschmidtMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I'm told that the kind of member access that you're trying to do isn't supported with the current (May) CTP. It will probably be supported in the next one, however. So the real answer is that "M" doesn't yet do what you're trying to do, but will.

    .Kraig

All Replies