Understanding HasExtentName / Mixin / InheritanceIn the Models\Repository\System directory there is a type called HasExtentName:<br/> <br/> <strong>module </strong> System <br/> {<br/>     <strong>export </strong> HasExtentName;    <br/> <br/>     // Mixin used to include an extent name field in the root extent of a vertical partition<br/>     // when implementing a generalization hierarchy that allows only single parenting.         <br/>     <strong>type </strong> HasExtentName<br/>     {<br/>         ExtentName: Text; <br/>     }    <br/>     <br/> }<br/> <br/> It seems like this pattern was used for example in Microsoft.Samples.Process.Activities where each activity has an ExtentName referencing a database of its particular subtype (e.g. UserTasks, Decisions...).<br/> <br/> Now I wonder how you would implement this Mixin pattern and how it actually differs from the inheritance pattern using a discriminator field (as shown here: http://blogs.msdn.com/dave_langer/archive/2009/06/02/modeling-inheritance-in-oslo-s-m.aspx, <strong><span style="font-family:Calibri;font-size:small">Table per Concrete Class</span> </strong> ). Intuitively, I would say, you use &quot;ExtenName&quot; as a discriminator field, but then again I would end up defining constraints for the allowed subtypes (UserTasks, Decisions,...).<br/> <br/> Could you provide a simple example (MSchema and MGraph) how to apply the &quot;HasExtentName&quot; (maybe you could stick to the example provided in the article above: Department has different kinds of Employees) ?© 2009 Microsoft Corporation. All rights reserved.Wed, 01 Jul 2009 11:28:53 Z2039f8ea-7b9f-432a-852d-f8ea01deaebehttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#2039f8ea-7b9f-432a-852d-f8ea01deaebehttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#2039f8ea-7b9f-432a-852d-f8ea01deaebeslyVxhttp://social.msdn.microsoft.com/Profile/en-US/?user=slyVxUnderstanding HasExtentName / Mixin / InheritanceIn the Models\Repository\System directory there is a type called HasExtentName:<br/> <br/> <strong>module </strong> System <br/> {<br/>     <strong>export </strong> HasExtentName;    <br/> <br/>     // Mixin used to include an extent name field in the root extent of a vertical partition<br/>     // when implementing a generalization hierarchy that allows only single parenting.         <br/>     <strong>type </strong> HasExtentName<br/>     {<br/>         ExtentName: Text; <br/>     }    <br/>     <br/> }<br/> <br/> It seems like this pattern was used for example in Microsoft.Samples.Process.Activities where each activity has an ExtentName referencing a database of its particular subtype (e.g. UserTasks, Decisions...).<br/> <br/> Now I wonder how you would implement this Mixin pattern and how it actually differs from the inheritance pattern using a discriminator field (as shown here: http://blogs.msdn.com/dave_langer/archive/2009/06/02/modeling-inheritance-in-oslo-s-m.aspx, <strong><span style="font-family:Calibri;font-size:small">Table per Concrete Class</span> </strong> ). Intuitively, I would say, you use &quot;ExtenName&quot; as a discriminator field, but then again I would end up defining constraints for the allowed subtypes (UserTasks, Decisions,...).<br/> <br/> Could you provide a simple example (MSchema and MGraph) how to apply the &quot;HasExtentName&quot; (maybe you could stick to the example provided in the article above: Department has different kinds of Employees) ?Thu, 04 Jun 2009 12:08:21 Z2009-06-04T12:08:21Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#481f1494-4a19-4f9f-9f30-b510179b2544http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#481f1494-4a19-4f9f-9f30-b510179b2544Kraig Brockschmidthttp://social.msdn.microsoft.com/Profile/en-US/?user=Kraig%20BrockschmidtUnderstanding HasExtentName / Mixin / Inheritance<p>Just a quick note--I'll find someone to answer this for you on Monday. Have a great weekend and thanks for all your provocative posts this last week!<br/><br/>.Kraig</p>Sat, 06 Jun 2009 03:36:19 Z2009-06-06T03:36:19Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#c6f18b09-82e6-4e55-8a03-9946a65c45c0http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#c6f18b09-82e6-4e55-8a03-9946a65c45c0slyVxhttp://social.msdn.microsoft.com/Profile/en-US/?user=slyVxUnderstanding HasExtentName / Mixin / InheritanceThanks Kraig. And thank you for taking time to answer all these questions.Sat, 06 Jun 2009 15:54:49 Z2009-06-06T15:54:49Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#45a5cbd6-8821-4f83-8e17-f9e95cffaf6fhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#45a5cbd6-8821-4f83-8e17-f9e95cffaf6fKraig Brockschmidthttp://social.msdn.microsoft.com/Profile/en-US/?user=Kraig%20BrockschmidtUnderstanding HasExtentName / Mixin / Inheritance<p>Someone should be getting back to you shortly. Sorry it's taking so long.</p>Fri, 12 Jun 2009 15:25:24 Z2009-06-12T15:25:24Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#da089224-4dd8-4ff0-92e8-c8fac0bee254http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#da089224-4dd8-4ff0-92e8-c8fac0bee254Bill Gibson MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Bill%20Gibson%20MSFTUnderstanding HasExtentName / Mixin / Inheritance<p>Sorry this has taken so long!<br/><br/>The type System.HasExtentName is a hangover from an earlier approach to modeling generalization and was intended to be used as you surmised.  That pattern has been dropped in favor of other approaches that have broader use -- the extent name pattern arose from consideration of just one of the implementation patterns - extent/table-per-type - and had many limitations.  We will be removing HasExtentName in the next drop so I suggest you pretend it was never there!  Modeling generalization is an important scenario for us and is hugely important in our UML model, where you can already see some evidence of some of the patterns we're using.  Stay tuned for more on this topic soon!  <br/><br/>Bill    </p>Fri, 12 Jun 2009 17:16:22 Z2009-06-12T17:16:22Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#47865529-14a0-4823-a3e5-50ff92a45d18http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#47865529-14a0-4823-a3e5-50ff92a45d18slyVxhttp://social.msdn.microsoft.com/Profile/en-US/?user=slyVxUnderstanding HasExtentName / Mixin / InheritanceOk, thank you for clearing that up.<br/> <br/> I stay tuned ;)Sun, 14 Jun 2009 16:34:42 Z2009-06-14T16:34:42Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#8c5353ef-698d-4261-b607-94023be8b8c3http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/2039f8ea-7b9f-432a-852d-f8ea01deaebe#8c5353ef-698d-4261-b607-94023be8b8c3slyVxhttp://social.msdn.microsoft.com/Profile/en-US/?user=slyVxUnderstanding HasExtentName / Mixin / InheritanceHello,<br/> <br/> I've got a further question about the implementation of the inheritance pattern discussed here. (Even though you said it will be dropped in future versions, I still consider it as the best approach <em>at the moment</em> ).<br/> <br/> This time it's not about the extent name issue. I'm interesting in the way you model the child class in terms of Primary Key, Foreign Key, and unique constraint.<br/> <br/> Let me explain it: So far I know three different ways to model the child class (see below). All three versions work fine for me. <br/> <br/> Do you see any advantages/disadvantages for any of these versions, in terms of both &quot;M&quot; and SQL considerations? <br/> <br/> <br/> // Version 1 (PK = FK), based on Shawn Wildermuth's version (http://wildermuth.com/2008/11/08/MSchema_and_Decorator_Tables)<br/> <strong>module </strong> Demo<br/> {<br/>     <strong>type </strong> Person<br/>     {<br/>         name : Text;<br/>         ID   : Integer32 =&gt; AutoNumber();<br/>     } <strong>where identity </strong> ID;<br/>     <br/>     <strong>type </strong> Employee<br/>     {<br/>         jobTitle : Text;<br/>         person   : Person;<br/>     } <strong>where identity </strong> (person), <strong>value</strong> .person <strong>in </strong> Persons;<br/>     <br/>     Employees : Employee*;<br/>     Persons : Person*;  <br/> }<br/> <br/> <span style="text-decoration:underline"><br/> </span> // Version 2 (PK, FK = UNIQUE), based on the [Microsoft.Samples.Processes.Process] models<br/> <strong>module </strong> Demo<br/> {<br/>     <strong>type </strong> Person<br/>     {<br/>         name : Text;<br/>         ID   : Integer32 =&gt; AutoNumber();<br/>     } where identity ID;<br/>     <br/>     <strong>type </strong> Employee<br/>     {<br/>         person   : Person;<br/>         jobTitle : Text;<br/>         employeeID : Integer32 =&gt; AutoNumber();<br/>     } <strong>where identity </strong> (employeeID), <strong>unique</strong> (person), <strong>value</strong> .person <strong>in </strong> Persons;<br/>     <br/>     Employees : Employee*;<br/>     Persons : Person*;<br/> }<br/> <br/> <br/> // Version 3 (compound FK, PK), my own version<br/> <strong>module </strong> Tests.EmployeeInheritance<br/> {<br/>     <strong>type </strong> Person<br/>     {<br/>         name : Text;<br/>         ID   : Integer32 =&gt; AutoNumber();<br/>     } <strong>where identity </strong> ID;<br/>     <br/>     <strong>type </strong> Employee<br/>     {<br/>         jobTitle : Text;<br/>         person   : Person;<br/>         employeeID : Integer32 =&gt; AutoNumber();<br/>     } <strong>where identity </strong> (person, employeeID), <strong>value</strong> .person <strong>in </strong> Persons;<br/>     <br/>     Employees : Employee*;<br/>     Persons : Person*;  <br/> }Wed, 01 Jul 2009 11:28:53 Z2009-07-01T11:28:53Z