Note that there are some explanatory texts on larger screens.

plurals
  1. POSubSonic 3 and composite foreign keys
    primarykey
    data
    text
    <p>I'm current evaluating SubSonic 3 for use with a legacy DB - IE very little ability to change the current structure.</p> <p>Long story short SubSonic 2 handled our composite foreign keys pretty well - however we're looking for something that will providew linq and all the rest that goes along with SS3.</p> <p>So far I've found that SS3 using both the ActiveRecord.tt and Classes.tt T4 templates I get very very messed up relationships. </p> <p>I've noticed that if a property is suffixed with an "x" the logic inside the foreign keys doesn't include the "x" - example generated code below.</p> <pre><code> #region Properties partial void OnAUDIT_TYPEXChanging(int value); partial void OnAUDIT_TYPEXChanged(); private int _AUDIT_TYPEX; public int AUDIT_TYPEX { get{ return _AUDIT_TYPEX; } set{ this.OnAUDIT_TYPEXChanging(value); this.SendPropertyChanging(); this._AUDIT_TYPEX = value; this.SendPropertyChanged("AUDIT_TYPEX"); this.OnAUDIT_TYPEXChanged(); } } #region Foreign Keys public IQueryable&lt;COMPANY_AUDIT_TYPE&gt; COMPANY_AUDIT_TYPES { get { var db=new DB(); return from items in db.COMPANY_AUDIT_TYPES where items.AUDIT_TYPE == _AUDIT_TYPE // ERROR HERE NO "X" SUFFIX, SHOULD BE _AUDIT_TYPEX select items; } } </code></pre> <p>Also the generators completly die when they reach composite keys. Instead of generating ONE property they generate four and start mixing the comparsomes. see generated code below</p> <pre><code> #region Foreign Keys public IQueryable&lt;EMPLOYEE&gt; EMPLOYEES { get { var db=new DB(); return from items in db.EMPLOYEES where items.COMPANY_ID == _COMPANY_ID select items; } } public IQueryable&lt;EMPLOYEE&gt; EMPLOYEES1 { get { var db=new DB(); return from items in db.EMPLOYEES where items.EMPLOYEE_NUM == _COMPANY_ID select items; } } public IQueryable&lt;EMPLOYEE&gt; EMPLOYEES2 { get { var db=new DB(); return from items in db.EMPLOYEES where items.COMPANY_ID == _EMPLOYEE_NUM select items; } } public IQueryable&lt;EMPLOYEE&gt; EMPLOYEES3 { get { var db=new DB(); return from items in db.EMPLOYEES where items.EMPLOYEE_NUM == _EMPLOYEE_NUM select items; } } </code></pre> <p>ideally it would just generate </p> <pre><code> #region Foreign Keys public IQueryable&lt;EMPLOYEE&gt; EMPLOYEES { get { var db=new DB(); return from items in db.EMPLOYEES where items.COMPANY_ID == _COMPANY_ID &amp;&amp; EMPLOYEE_NUM == _EMPLOYEE_NUM select items; } } </code></pre> <p>Does SS3 properly support composite foreign keys, my results lead me to fear that it does not.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload