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

NVarchar(max) get limited to string[255] in WCF Ria Domain Service

10 Answers 95 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jörg
Top achievements
Rank 2
Jörg asked on 26 Oct 2011, 06:26 PM
I use the OpenAccess tool for my web application. The Designer corretly imports the data from sql server and creates a "CLOB" type for my memo fields. Everything works perfect.

Now I have added a Silverlight widget that uses WCF Ria Services to access the data and basically it works.
However I have noticed that the generated code in the Silverlight project shows a limitation of 255 characters for all the memo fields which is a problem.
The problem is that updates do not work for entities, even when the relavant columns have not been changed, I immediately get a verification error back.

Is this a know issue in the code generator?

Any help is appreciated
Joerg

10 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 31 Oct 2011, 04:54 PM
Hello Jörg ,

 We haven't had such issue reported up until now. Can you please share with me the exact version of OpenAccess you are using. The reason I am asking you this is because in versions prior to Q2 we had a problem where our internal concurrency mechanism was interfering with the one used by RIA and that caused all updates to fail.
In order to test this can you please turn off our concurrency mechanism for the class with which you are testing and see if that fixes your problem?

All the best,
Petar
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Jörg
Top achievements
Rank 2
answered on 31 Oct 2011, 09:28 PM
Hi Petar

I am using the newest version (Telerik.Open.Access 2011.2.713.3).
Here the detailed info through the various layers (including a screen shot for every item in the list).

- On the SQL Server database I have a user defined data type called MemoText defined as nvarchar(max)
- On various tables I use this datatype, for example the column "ActualStatus"
- In the ORM designer the column is modeled as a string
- In the XML definition of the rlinq file the column ActualStatus is shown with length 0 and ado-type CLOB which is correct.
- On the server side I created a DomainService, but there is nothing special to see
- In the Silverlight project the generated code for the columns which are modeled with nvarchar(max) (or to be more precise the ones with the user defined data type have a max length of 255 chars.

Hope with this information you will be able to reproduce the error.

Regards
Jörg
0
PetarP
Telerik team
answered on 03 Nov 2011, 06:16 PM
Hello Jörg ,

 I have tried the same and I can confirm that the string is not trimmed. I haven't done any additional settings nor have I written any code to handle the string. Is it possible that you have a limitation somewhere in your model that causes the trimming? 
If you are willing I will create a sample project for you so that you can test on your side and see if it fails.

Best wishes,
Petar
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Jörg
Top achievements
Rank 2
answered on 08 Nov 2011, 01:41 PM
Hi Petar

I created a small solution that proves my previous statements. Nvarchar(max) get trimmed to string(255) in the generated code file of the Silverlight application. Here the related code snippet of the generated file:

          /// <summary>
       /// Gets or sets the 'Description' value.
       /// </summary>
       [ConcurrencyCheck()]
       [DataMember()]
       [RoundtripOriginal()]
       [StringLength(255)]
       public string Description
       {
           get
           {
               return this._description;
           }
           set
           {
               if ((this._description != value))
               {
                   this.OnDescriptionChanging(value);
                   this.RaiseDataMemberChanging("Description");
                   this.ValidateProperty("Description", value);
                   this._description = value;
                   this.RaiseDataMemberChanged("Description");
                   this.OnDescriptionChanged();
               }
           }
       }

I tried to attach the project as a Zip but it is not possible anymore.
Can I send you the project as a ZIP file by mail?
Can you please look into this?

Regards
Jörg

0
PetarP
Telerik team
answered on 14 Nov 2011, 06:14 PM
Hi Jörg ,

First of all, let me apologize for the late answer.
Using absolutely the same setup I ended up with this code being generated:

/// <summary>
        /// Gets or sets the 'Description' value.
        /// </summary>
        [ConcurrencyCheck()]
        [DataMember()]
        [RoundtripOriginal()]
        public string Description
        {
            get
            {
                return this._description;
            }
            set
            {
                if ((this._description != value))
                {
                    this.OnDescriptionChanging(value);
                    this.RaiseDataMemberChanging("Description");
                    this.ValidateProperty("Description", value);
                    this._description = value;
                    this.RaiseDataMemberChanged("Description");
                    this.OnDescriptionChanged();
                }
            }
        }
Can you please confirm that you have not decorated your model properties with some additional attributes? Also can you please share with me if you are using xml mapping or attribute one?

Regards,
Petar
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Jörg
Top achievements
Rank 2
answered on 17 Nov 2011, 11:58 AM
Hi Petar

Yes I can confirm that I did not add any manual attributes or the like. But maybe our setup is not 100% the same?
I have prepared a demo project that you can download from http://www.evelix.ch/Software/RiaMemoDemoSample.zip 
This demo also contains a sql script to create the database.

Can you see any differences to your project? Does it work at your side without the string limitations?

Regards
Jörg 
0
PetarP
Telerik team
answered on 22 Nov 2011, 10:25 AM
Hi Jörg ,

 I am sorry for the late replay but we have been busy with the release. I will download your project and your database today and write back as soon as I am able to locate the problem. Thank you for the detailed information you have provided.

Regards,
Petar
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Michael
Top achievements
Rank 1
answered on 06 Nov 2012, 07:33 PM
Update?
0
PetarP
Telerik team
answered on 09 Nov 2012, 10:40 AM
Hello Michael,

 This was confirmed to be a bug on our side that has been fixed.

Greetings,
Petar
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
0
Michael
Top achievements
Rank 1
answered on 09 Nov 2012, 04:15 PM
Ok
Tags
Web Services
Asked by
Jörg
Top achievements
Rank 2
Answers by
PetarP
Telerik team
Jörg
Top achievements
Rank 2
Michael
Top achievements
Rank 1
Share this question
or