This is a migrated thread and some comments may be shown as answers.

Updating SQL schema failed... field uses the db-ref extension... referenced class does not use application identity

3 Answers 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
IT
Top achievements
Rank 1
IT asked on 25 Jun 2010, 07:57 AM
New project, using VS2010 with ORM 2010.1.527 for the first time (previously VS2008 w/ 2009.3.1119)

Trying a simple one-to-many class... and (suddenly) getting the following when trying to compile:-

Error    1    OpenAccess Error: Telerik.OpenAccess: Updating SQL schema failed. The field 'colour' of class 'Meta.Catalogue.Product' uses the db-ref extension, but the referenced class 'Meta.Catalogue.Colour' does not use application identity. --> C:\Development\Meta\Meta\bin\Debug\Meta.dll:(resource)Meta.App.config:mapping-id=mssqlMapping/namespace[Meta.Catalogue]/class[Product]/field[colour]/db-ref="id"    MetaWeb    


Here are relevant bits of code (only sections provided):

App.config:-

          <class name="Product">
            <extension key="db-table-name" value="metaCatalogueProduct" />
            <extension key="db-key-generator" value="AUTOINC" />
            <field name="colour">
              <extension key="db-ref" value="id">
                <extension key="db-column">
                  <extension key="db-column-name" value="colour_id" />
                </extension>
              </extension>
            </field>
            <field name="finish">
              <extension key="db-ref" value="id">
                <extension key="db-column">
                  <extension key="db-column-name" value="finish_id" />
                </extension>
              </extension>
            </field>
            <field name="size">
              <extension key="db-ref" value="id">
                <extension key="db-column">
                  <extension key="db-column-name" value="size_id" />
                </extension>
              </extension>
            </field>
            <field name="style">
              <extension key="db-ref" value="id">
                <extension key="db-column">
                  <extension key="db-column-name" value="style_id" />
                </extension>
              </extension>
            </field>
          </class>
...
          <class name="Colour">
            <extension key="db-table-name" value="metaCatalogueColour" />
            <extension key="db-key-generator" value="AUTOINC" />
          </class>


Product class:

using Telerik.OpenAccess;

namespace Meta.Catalogue
{
    [Persistent(IdentityField = "id")]
    public class Product
    {
        private int id;
        [FieldAlias("id")]
        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        private Style style;
        [FieldAlias("style")]
        public Style Style
        {
            get { return style; }
            set { style = value; }
        }

        private Colour colour;
        [FieldAlias("colour")]
        public Colour Colour
        {
            get { return colour; }
            set { colour = value; }
        }
...


Colour class:

using Telerik.OpenAccess;

namespace Meta.Catalogue
{
    [Persistent(IdentityField = "id")]
    public class Colour
    {
        private int id;
        [FieldAlias("id")]
        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        private string name;
        [FieldAlias("name")]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }
}


I've searched for this error message, and cannot find anything

Thanks in advance for any help anyone can provide.












3 Answers, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 25 Jun 2010, 04:09 PM
Hello Aleks,

 The problem is in the mapping for the color field. Please remove the 'db-ref' extension from the field mapping. The db-column extension should be directly present under the field node

<field name="colour">
              <extension key="db-ref" value="id">
                <extension key="db-column">
                  <extension key="db-column-name" value="colour_id" />
                </extension>
              </extension>
</field>

The mapping should look like this
<field name="colour">
   <extension key="db-column">
           <extension key="db-column-name" value="colour_id" />
   </extension>
</field>

The 'db-ref' node is valid only when the class being referenced has multiple pk fields.

Do let me know if that helps.

Kind regards,
Ady
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
IT
Top achievements
Rank 1
answered on 26 Jun 2010, 12:49 AM
Ady,

Thanks for your help.

That seems to have done the trick.

Is there a corresponding control in the forward mapping GUI that controls these elements in the XML? It seems I've done something at some stage that has either caused these elements to be added, or if they were already there, caused them to throw the exception.

I notice I also intermittently get the following:-

Error    6    OpenAccess: C:\Development\Meta\Meta\obj\Debug\Meta.dll: Error: Could not resolve: Telerik.OpenAccess.35.Extensions, Version=2010.1.527.2, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342        

Running "Check Config" seems to fix it, but it will just pop up again a few compiles later.


Best regards,
Aleks


0
Ady
Telerik team
answered on 28 Jun 2010, 05:13 PM
Hello Aleks,

 These entries are managed by the Forward mapping dialog when you edit the mapping for a field. You should not normally need to manually edit it in the config file. I am not sure how you got these invalid entries in the config file. Did you, at any point, manually edit the mapping?

Regarding the second error - it indicates that the Telerik.OpenAccess.35.Extensions assembly reference in the project references points to another (probably older) version of the assembly. The wizard is updating the reference to the latest version that is installed on your machine. Does this error occur even if you do not update to a new version? It should not.

Sincerely yours,
Ady
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
IT
Top achievements
Rank 1
Answers by
Ady
Telerik team
IT
Top achievements
Rank 1
Share this question
or