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

DataTypes and WCF DataService

4 Answers 143 Views
Integration with other products
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brian
Top achievements
Rank 1
Brian asked on 11 Nov 2010, 11:44 PM
I created two projects one for my service (asp.net website) and the second as a library with OpenAccess.  When I try to expose the database using DataServices the service throws an error because some of my fields are Char datatype.  I can change thee .generated.cs files to int16 however this is a hack and will have to be changed each time I regenerate.  Please let me know if there is an alternative to this.

Error:
The exception message is 'The property 'CityType' on type 'Ekwipper.Grocery.Data.City' is not a valid property. Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'. See server logs for more details. The exception stack trace is:

Generated Property
private System.Nullable<System.Char> cityType;
        [Column("cityType", OpenAccessType = OpenAccessType.Character, IsNullable = true, Length = 1, SqlType = "char")]
        [Storage("cityType")]
        public virtual System.Nullable<System.Char> CityType 
        
            get
            {
                return this.cityType;
            }
            set
            {
                this.cityType = value;
            }
        }

Thanks in Advance!

4 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 12 Nov 2010, 09:23 AM
Hi Brian,

The problem is that System.Char is not among the supported by WCF Data Services primitive types. The full list of supported primitive types is here - http://msdn.microsoft.com/en-us/library/bb399213.aspx. You can read more about the problem is this thread.
A possible solution would be to use string instead of char (by changing the property type in the visual designer).

Sincerely yours,
Jordan
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
Brian
Top achievements
Rank 1
answered on 12 Nov 2010, 03:20 PM
I figured that this was the problem however why doesn't OpenAccess map to string?  NetTiers another ORM has some base routines that swap out db types for c# types and can be adjusted.

I went to the rlinq model and changed the datatype however it did not change the City.generated.cs code.  I probably just don't understand how to regenerate the entities.  Any help?

0
Brian
Top achievements
Rank 1
answered on 12 Nov 2010, 10:44 PM
I figured it out for some reason when I saved the rlinq file it would not update.  Still think that your tool should change the datatype or at least warn us for any datatype that is not compatible with the DataService so we can manually make the change. 
0
Jordan
Telerik team
answered on 17 Nov 2010, 08:52 AM
Hello Brian,

Thank you for your feedback.
We already have such a task on our TODO list for the DSW.
The next version will check if you have selected to use WCF Data Services and also have properties of type char (or other incompatible type) in your model and warn you about that.

Do not hesitate to write again if you have more questions or suggestions.

Regards,
Jordan
the Telerik team
See What's New in Telerik OpenAccess ORM in Q3 2010!
Monday, November 15, 11 am Eastern Time: Register here>>
Monday, November 15, 10 pm Eastern Time: Register here>>
Tags
Integration with other products
Asked by
Brian
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Brian
Top achievements
Rank 1
Share this question
or